Closed Jackodb closed 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
Ignore duplicate indexes: verify_integrity
:
https://www.geeksforgeeks.org/python-pandas-dataframe-append/
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]]
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)