Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strategy gets wrong DataFrame #69

Open
sertans opened this issue Sep 19, 2018 · 0 comments
Open

Strategy gets wrong DataFrame #69

sertans opened this issue Sep 19, 2018 · 0 comments
Assignees
Labels

Comments

@sertans
Copy link

sertans commented Sep 19, 2018

Hello,
I hope this Issue is correct. I was testing the ema strategy and started to take a look at the code. I followed the path of the DataFrame when pairs are traded. I printed the pairs within the exchange.py get_offline_ticker() function and they were right. this function returns the DataFrame which later gets into the strategy calculate() function. I printed the dataframe within the calculate function and saw the following:
102 5ba222ce1cdd4b98740401ac polo-USDT_ETH-1537352100 1537352100 ... USDT_ETH USDT ETH 103 5ba21fa31cdd4b9874031ab7 polo-USDT_BCH-1537350900 1537350900 ... USDT_BCH USDT BCH 104 5ba2230d1cdd4b9874040200 polo-USDT_BTC-1537352100 1537352100 ... USDT_BTC USDT BTC 105 5ba223081cdd4b98740401fe polo-USDT_LTC-1537351500 1537351500 ... USDT_LTC USDT LTC 106 5ba222ce1cdd4b98740401ac polo-USDT_ETH-1537352100 1537352100 ... USDT_ETH USDT ETH

this is the head of the df with these pairs: ['USDT_BTC', 'USDT_LTC', 'USDT_ETH', 'USDT_BCH']

The problem I see here is how ema is calculated:
ema5 = talib.EMA(close[-5:], timeperiod=5)[-1] ema10 = talib.EMA(close[-10:], timeperiod=10)[-1] ema20 = talib.EMA(close[-20:], timeperiod=20)[-1]
It takes the last 5/10/20 entries of the dataframe, even if those are entries from another pair.
With the given example I get this output : close_price: 6378.0 ema: 1775.8421071704997 which is the close_price from bitcoin and the ema calculated over all other currencies, which might be a reason why the algorithm fails. Is this a bug or isn't the multi pair feature not already build in?

@miro-ka miro-ka self-assigned this Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants