Time to talk about brokers, how to place a trade programmatically and most importantly how not to get scammed. This is the third part forex scalping indicator 2014 super the series: How to build your own algotrading platform.
In our case, we don’t really care about spread as we won’t be doing High Frequency Trading any time soon. Even though brokers are regulated, there have been incidents in the past couple of years, were brokers folded due to certain conditions. What could happen is that you start making some money and you aren’t be able to pull them out. But let’s switch to a happier note which is opening an account and placing our first programmatic trade. API, libraries on github and a free demo account. After you sign in to your demo account, go to Manage API Access. There you can find your API key which we are going to use in our system to place trades.
MAKE SURE YOU DON’T SHARE THIS KEY. The code for this is and all other posts is on github and you can install it and run it pretty easily. Connecting to Oanda needs a conf file – which you can generate using a script that Oanda provides here or you can just create it yourself. I prefer to know everything that is going on. And I don’t like having to install PyYAML just to read a conf file.
Feel free to use either method. Check the current price is as easy! Don’t worry about what EURUSD is or how many units we are buying or what a market order is. For now, we have placed our first trade from our laptop and we are going to build our own API to place trades. You can read Oanda’s documentation here to see what else you can do with their API and find the Python library here. Tons of examples are available from Oanda’s github page here.
Coming up next, connecting to a real LIVE algotrading system, running from my RaspberryPI at home. If you have more feedback, ping me at jonromero or signup to the newsletter. This is an engineering tutorial on how to build an algotrading platform for experimentation and FUN. Any suggestions here are not financial advices. Posted Tue 06 December 2016 in trading.
This is the another post of the series: How to build your own algotrading platform. I get this question almost on a daily basis. How can I find a good strategy? How can I built my own? Do I need to have a PhD in mathematics? Newsflash: If I can write a strategy, anyone can write a strategy.
The only trick is to look for a simple one. I started getting involved with Ethereum early on as I really liked the “run your algorithms on the blockchain” thing. When TheDAO came out, I read everything about it and loved the idea. The same ideas apply to Forex, Stocks even Pokemon balls. I personally, have a specific way that I work. Step one : Identify an idea.
My idea in this case is that there are a couple of exchanges offering Ethereum and DAO tokens. What if there was an arbitrage between those? Step two : Manually test the idea. If something “kinda works”, I am on to something. All I had to do is execute all the steps manually and write down any fees, conditions or anything that should be documented. This algorithm is not a high frequency trading algorithm. I did could be done manually.
The problem is that I would have to spend all time in front of my computer, checking if there is an arbitrage condition and if there was, I had to act fast and without messing up. Oh and I had to recruit five of my friends to scale this up. Long story short, I spent Presidents’ Day writing a simple program that will replay all my manual steps. The program would crash and it was not more that 100 lines of code. This is the data collection stage where I see if there is an advantage that algorithms can give me. If there is at least one or more conditions met, I will start building and rewriting the algo. I am kidding and you’ll see in a bit why risk management is super important in this business.