Jackodb / Visualization

Visualization using DASH/Plot.ly
0 stars 0 forks source link

How to determine center price? #15

Closed Jackodb closed 5 years ago

Jackodb commented 5 years ago

vvk: I would use worker's buy/sell orders and calculate the price in the same way we're using for market_center_price, e.g. center on logarithmic scale center_price = buy_price * math.sqrt(sell_price / buy_price)

Jackodb commented 5 years ago

Apply sell and buy labels to the index of every row to determine lowest sell and highest buy.

Use a column as the index: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.set_index.html

Get lowest sell and highest buy:

sell = df.loc[['sell'],['price']].iloc[0]['price']
buy = df.loc[['buy'],['price']].iloc[-1]['price']

https://stackoverflow.com/questions/16729574/how-to-get-a-value-from-a-cell-of-a-dataframe

Jackodb commented 5 years ago

Ignore duplicate indexes: verify_integrity: https://www.geeksforgeeks.org/python-pandas-dataframe-append/

Jackodb commented 5 years ago

Get rows based on label/index: https://www.shanelynn.ie/select-pandas-dataframe-rows-and-columns-using-iloc-loc-and-ix/

Get a column based on the index and name of column: df.loc[[label/index],[column]]

Screenshot 2019-08-14 at 11 02 26

Jackodb commented 5 years ago

https://stackoverflow.com/questions/46113078/pandas-add-value-at-specific-iloc-into-new-dataframe-column