Open streetgainer opened 5 years ago
Havent been using 2.0. Is it needed? Ping me if you have something in mind
I actually started the process, my oanda account is v2. So I'm doing the conversion line by line in the oanda.py script. Could you answer this, CANDLES_MINUTES
is set in settings.py, what is the difference with that setting and size_of_candles_in_minutes
that is used in oanda.py
I'm a js programmer, never programmed python so forgive me if this seems like a dumb question. Thanks
I see. Thanks for doing this.
As you can see, I based the bot on oandapy.py - which was the REST-level wrapper around their 1.0 API. So may be its just as simple as replacing that wrapper?
As far as your question - settings.py contain bot-level settings that later are passed as parameters to other places in the code. In particular, CANDLES_MINUTES define what size candles to use, meaning how many minutes in a single candle should be. Then that value is used in main.py to pass onto as a parameter to a Strategy object. When strategy initialized itself, it tries to get historic data from the exchange (using GetCandles function). And I think it passes the value of CANDLES_MINUTES to that function.
Let me know if I can be of further assistance, or if you need help with the code
Yes, I thought that's what should be happening, but it's not, settings.py is only sending that CANDLES_MINUTES
parameter to backtest.py, everywhere else throughout the script the candle size is being initialised individually like this..def __init__(self, oanda, candle_size = 120, email = None, risk = 2)
this is from strategy.py
So it seems there is a bug there, as setting it in settings.py only won't propagate correctly throughout the rest of the script.
No, no bug here. Look, you launch the bot by executing python main.py Therefore main.py is the entry point. Strategy initialization happens in main.py on line 32: https://github.com/PeterMalkin/oandapybot/blob/master/main.py#L32 As you can see, the value is passed to the object constructor. And it is defined in the settings.py. What you are quoting is the default value for the function parameters, which is a separate feature of Python programming language. See more here: https://www.geeksforgeeks.org/default-arguments-in-python/
Ok, bare with me. I'm a JS programming and have never programmed in Python, so I assumed it to be the same variable assignment procedure. Shame on me for that, I do apologize. Thanks for all your help thus far.
Oh, no worries at all. Happy to help if I can
Is there a v20 update?