Giter VIP home page Giter VIP logo

tos-rtd-core's Introduction

TOS-RTD project

Context

There is a lot of buzz about institutional algorithmic trading on the stock market. There is also great interest in machine learning (here obviously). As an absolute beginner in ML with an interest in stock trading, I went looking for a market dataset that I could use.

While there are datasets available with daily closing prices (Yahoo finance), I couldn't find any publicly available with more granular data, much less anything close to having a real time data stream.

I have a trading account with TD Ameritrade. Their main desktop trading platform is called ThinkorSwim (TOS) and it has awesome capabilities. One feature is a Real Time Data (RTD) interface where Excel can pull price data from the platform at about a 3 second update rate. Using Visual Basic, I set up an Excel 'tunnel' to pull in data and then save it.

This project is the core of that capture method. (My home system uses an SQL DB, but that is beyond basic core functionality....)

While the TOS RTD interface is one way (you cannot send trade orders to the platform), I can imagine a system that could deliver trading advice based on this near real time data. A real time multi-timescale momentum based price prediction tool maybe?

Dataset Content

The dataset generated is 3 second interval price data using the futures trading windows - basically 24-7, from 6 PM EST Sunday to 6 PM Friday. A futures trading day starts at 6 PM on the day before a market trading day and ends at 5PM on the trading day. A new csv file is generated for each day.

The example group includes futures, stocks and ETFs. No attempt was made to limit specific captures to 'market open' time periods.

There may also be a few exception events where data points are lost. A TOS refusal msg popped occassionally.

Prerequisites

This project was built quick and dirty on an unspectacular Win10 machine.

There are three common software packages involved -

  • Visual Studio Community 2019
  • Excel - 2003 and 2010 versions were tested
  • ThinkorSwim - a free download for customers of TD Ameritrade. I STRONGLY encourage any trader to get a TDA account and this package. -This project works on both the 'live trading' and the 'paper trading' TOS settings.
    • Note - The TOS / TD EULAs limit their software to non-professional trader usage.

Project build

Create folders:

  • C:\temp\TOS Import core\deploy
  • C:\temp\TOS Import core\data

Visual Studio:

  • Start page - choose - Create a new project, VB, Windows, desktop, Windows Forms App
  • choose a project name and save location.

Go to form1 > view design -

  • add a default label (Label1)
  • add a default timer (Timer1)
  • add a named timer (tmrExcelLoad)

Go to Project \ Properties \ References -

  • add COM ref 'Microsoft Excel xx.x Object Library'. (xx.x is the version of Excel loaded on YOUR PC.)

Go to form1 > view code -

  • Copy & paste code in file 'TOS import core Form1.vb'

Build project / Save ALL

Start TOS.

  • Note - Excel does not need to be open to run pgr.

In VS IDE -

  • Press 'Start'

Normal events -

  • Form1 shows.
  • Label text = 'Excel Load Timer started' (Default displays for about 10 seconds while Excel loads in background. Adjust for your PC load time)
  • Label text = "XL TOS.RTD connection tested OK" (displayed about 5 seconds)
  • Label text = "CSV data write success @ ... (write timestamp)

Advanced (.exe) build:

Go to Project \ Properties \ Publish \ install mode

  • check 'This aplication is available offline..'
  • Select Updates
  • check 'The application should check for updates', 'Before application starts' and OK change Publish Location to c:\temp\TOS import core\deploy
    Press 'Publish Now'

Go to c:\temp\TOS import core\deploy\ and run setup.exe. OK through popups. Pgr should run.

'TOS import core' shortcut should be available in Start menu to run pgr without IDE.

tos-rtd-core's People

Contributors

brtnsmth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.