AI4Finance-Foundation / FinRL-Meta

FinRL­-Meta: Dynamic datasets and market environments for FinRL.
https://ai4finance.org
MIT License
1.2k stars 560 forks source link

sort_values issue #206

Open eithwa opened 2 years ago

eithwa commented 2 years ago

Since the order of tickers will be changed when add_technical_indicator is executed in DataProcessor, it is unable to use price_array to get the price of the specified ticker now.

https://github.com/AI4Finance-Foundation/FinRL-Meta/blob/cf36f3a47dab25e04c64a7524112de9c92a36cf6/meta/data_processors/_base.py#L191

https://github.com/AI4Finance-Foundation/FinRL-Meta/blob/master/tutorials/2-Advance/MultiCrypto_Trading.ipynb

TICKER_LIST = ['BTCUSDT','ETHUSDT','ADAUSDT','BNBUSDT','XRPUSDT',
                'SOLUSDT','DOTUSDT', 'DOGEUSDT','AVAXUSDT','UNIUSDT']
price_array = np.load('./price_array.npy')
btc_prices = price_array[:,0]
buy_hold_btc_returns = btc_prices/btc_prices[0]
zhumingpassional commented 1 year ago

How about "sort the tic names, and then calculate the index i, and get the value through index. "