jonromero / forex_algotrading

My Forex algotrading platform in Python - based on my posts at http://jon.io
MIT License
477 stars 178 forks source link

OANDA_ACCESS_TOKEN and OANDA_ACCOUNT_ID shouldn't be in script #3

Closed femtotrader closed 8 years ago

femtotrader commented 8 years ago

Hello,

it's not very safe to have OANDA_ACCESS_TOKEN and OANDA_ACCOUNT_ID in script (because you can accidentally push to GitHub these very private data)

You might have

Add config.py to .gitignore

config.default.py could be simply

OANDA_ACCESS_TOKEN="...."
OANDA_ACCOUNT_ID="..."

User will have to copy config.default.py to config.py and edit config.py

your scripts will contains

from config import OANDA_ACCESS_TOKEN, OANDA_ACCOUNT_ID

Kind regards

jonromero commented 8 years ago

That is how the full engine actually works. My approach is minimize editing of files while I explain the code and slowly expand. I don't want users that just want to try it out to edit any other files.

btw, this is from the full engine

def init(config):
    oanda = oandapy.API(environment=config['OANDA_ENVIRONMENT'], access_token=config['OANDA_ACCESS_TOKEN'])

    strategy_data = read_strategy(config['STRATEGY_FILE'])
    return oanda, strategy_data