Giter VIP home page Giter VIP logo

paper's Introduction

paper

This is the home for Trading Tommy! Tommy is a very simple trading bot that find opporunities to trade equity securities (stocks) on the NYSE. Currently, Tommy only makes decisions based on the price and the Relative Strength Index (RSI) of a symbol.

How to use

Step 1. Install required Python modules

To install all required Python modules as specified in requirements.txt, navigate to python/ and run:

python -m pip install -r requirements.txt

Step 2. Create a brokerage account with Alpaca

Follow the instruction on the Alpaca website to create an account.

Step 3. Set the environment variables

For the bot to retrieve data from the Alpaca API, you must set the APCA_API_KEY_ID and APCA_API_SECRET_KEY environment variables to the API Key and API Secret Key listed in the account you create from step 2.

Note: We highly recommend you use a paper account (that simulates trades instead of placing real orders) while you get started!

Step 4. Run the bot

Navigate inside python/ and run:

python3 main.py

In addition, you can pass in the following arguments:

  • Run the custom function and exit - for testing purpose
-c, --custom
  • Log debug messages
-d, --debug
  • Suppresses all output except critical, overrides debug
-q, --quiet
  • Store all output in the specified file
-o, --output
  • Specify the timeframe over which to calculate signals and make trades, in MINUTES - [1, 1440]
-t, --timeframe

The bot will identify optimal buying/selling points, and generate graphs to display the detected buying/selling points. The following is an example graph:

[Image to insert]

How it works

Tommy is split up into three main pieces:

  • Core.py is responisble for making web requests to Alpaca, for actions like fetching data and placing orders. These are almost entirely done through Alpaca's Python API.
  • Brain.py calculates quantitative finance signals, like the RSI, as well as determines whether a symbol should be bought or sold.
  • Platform.py decides the order in which different elements are run and the flow of the program. Currently, there are two main threads. The first thread loops through high-volume symbols (obtained from Util.py) and determines whether each should be bought or sold based on answers from Brain.py. The second thread fetches data from Alpaca in the background, which Brain.py uses to produce as up-to-date signals as possible.

paper's People

Contributors

eunicornbread avatar fewella avatar

Stargazers

 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.