Git Product home page Git Product logo

tradesystem's Introduction

tradesystem

Automated trading system using Interactive Brokers API to place event-driven positions

Link to published project: https://www.quantopian.com/posts/high-sharpe-weekly-strategy ***please see note

A fully functional automated trading system designed to trade around weekly EIA crude oil production output event.

This project contains two parts.

1st part: The backtesting engine written in third party Quantopian's Python IDE for the the purpose of gauging returns performance and relevant metrics. The engine uses a fetcher to grab a prepopulated csv delimited file containing the direction of a trade to be placed on Wednesdays during crude oil supply output release from the Energy Information Agency (EIA). The EIA production number is then compared against the American Petroleum Institute (API*)'s actual production output. If the de facto EIA's supply production is more than the API*'s number, then the supply count was underestimated and there is more supply than expected. In this case, the algorithm would place a short on the current front month crude oil futures, expecting it lower in price due to an "abundant" supply of the crude oil commodity. In the event that the EIA number is less than the API* number, the algorithm places a long trade expecting the price of crude oil to rise due to a supply "shortage".

2nd part: The live trade system, built using Java in NetBeans interfacing with Interactive Brokers's Trader Workstation (TWS) application programming interface (API), essentially performs the weekly trade in a real event driven environment. A critical component of the live system contains a technology customized to run multiple instances of web scrapers to grab the EIA output number at exactly 10:30 AM on Wednesday. This sends the first successfully scraped value to the DataListener class that immediately places an order to long/short the defined front month Crude Oil contract given there is a connection between the client application to TWS. The ordering syntax contains defined criteras such as quantity, type of order, etc. and also importantly a stop-loss limit order (and profit taking) attached to the trade.

A separate shell script was written to call for the orders to be exited for either a loss or profit, allowing the user to decide at the time of the event.

***Note: (Quantopian is a community sourced algorithmic trading development/execution engine. However as of November 2020, the business as shut down and is no longer able to provide backtesting and/or development of trading algorithms. Open sources libraries such as zipline, pyfolio, etc are still on github: https://github.com/quantopian. For an alterntive resource, please visit quantrocket.com, a similar engine for algorithmic trading development.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.