For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

Oanda Samples



  • Re: Help with oandatest.py on samples
    Hi, tried to request the v1 API token from Oanda but the customer support told me today that they don't support that anymore. It does say that v20 token is compatible with V1 API. I then created a token anyway and used the following command as per the above topic to start oandatest.py.

    python oandatest.py --account ..##1 --token ..##c1 --data0 GBP_USD --resample --timeframe Minutes --compression 1 --no-backfill_start --stake 1000 --trade

    but then it returned the following:
    File "oandatest.py", line 498
    runstrategy()
    ^
    IndentationError: expected an indented block

    Can you please advise if this is because of the version diffs or something else.
    Thank you


  • administrators

    @fbrand said in Oanda Samples:

    IndentationError: expected an indented block

    This is because you have an error in your code. Proper indentation is mandatory in Python.



  • @fbrand said in Oanda Samples:

    IndentationError: expected an indented block

    Most programming languages permit indentation, but don't enforce it. Python enforces it with an iron fist, it has caused confusion for many beginners. The error expected an indented block is probably caused by a mix of tabs and spaces and this can lead to some confusing errors. Putting in an extra space or leaving one out where it is needed will surely generate an error message . Some common causes of this error include:

    • Forgetting to indent the statements within a compound statement
    • Forgetting to indent the statements of a user-defined function.

    The indentation can be any consistent white space . It is recommended to use 4 spaces for indentation in Python, tabulation or a different number of spaces may work, but it is also known to cause trouble at times. Most editors have an option for automatically converting tabs to spaces. If your editor has this option, turn it on.


Log in to reply
 

});