All Projects → alpacahq → Example Hftish

alpacahq / Example Hftish

Example Order Book Imbalance Algorithm

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Example Hftish

Machine Learning And Ai In Trading
Applying Machine Learning and AI Algorithms applied to Trading for better performance and low Std.
Stars: ✭ 258 (-27.32%)
Mutual labels:  trading, finance, trading-algorithms
Jiji2
Forex algorithmic trading framework using OANDA REST API.
Stars: ✭ 211 (-40.56%)
Mutual labels:  trading, finance, trading-algorithms
Pandas Ta
Technical Analysis Indicators - Pandas TA is an easy to use Python 3 Pandas Extension with 130+ Indicators
Stars: ✭ 962 (+170.99%)
Mutual labels:  trading, finance, trading-algorithms
Turingtrader
The Open-Source Backtesting Engine/ Market Simulator by Bertram Solutions.
Stars: ✭ 132 (-62.82%)
Mutual labels:  trading, finance, trading-algorithms
tellerbot
Telegram Bot for over-the-counter trading
Stars: ✭ 17 (-95.21%)
Mutual labels:  finance, trading, asyncio
korbit-python
Korbit API wrapper for Python
Stars: ✭ 17 (-95.21%)
Mutual labels:  finance, trading, trading-algorithms
Py Market Profile
A library to calculate Market Profile (aka Volume Profile) for financial data from a Pandas DataFrame.
Stars: ✭ 153 (-56.9%)
Mutual labels:  trading, finance, trading-algorithms
Lean
Lean Algorithmic Trading Engine by QuantConnect (Python, C#)
Stars: ✭ 5,675 (+1498.59%)
Mutual labels:  finance, trading-algorithms, trading
Sequence-to-Sequence-Learning-of-Financial-Time-Series-in-Algorithmic-Trading
My bachelor's thesis—analyzing the application of LSTM-based RNNs on financial markets. 🤓
Stars: ✭ 64 (-81.97%)
Mutual labels:  finance, trading, trading-algorithms
Alpaca Backtrader Api
Alpaca Trading API integrated with backtrader
Stars: ✭ 246 (-30.7%)
Mutual labels:  trading, finance, trading-algorithms
Ta Rs
Technical analysis library for Rust language
Stars: ✭ 248 (-30.14%)
Mutual labels:  trading, finance, trading-algorithms
AutoTrader
A Python-based development platform for automated trading systems - from backtesting to optimisation to livetrading.
Stars: ✭ 227 (-36.06%)
Mutual labels:  finance, trading, trading-algorithms
stocklist
Stock data collection and analysis
Stars: ✭ 27 (-92.39%)
Mutual labels:  finance, trading, trading-algorithms
trading sim
📈📆 Backtest trading strategies concurrently using historical chart data from various financial exchanges.
Stars: ✭ 21 (-94.08%)
Mutual labels:  finance, real-time, trading
neural-finance
Neural Network for HFT-trading [experimental]
Stars: ✭ 67 (-81.13%)
Mutual labels:  finance, trading
juncture
Low latency connectivity to trading venues on the JVM
Stars: ✭ 31 (-91.27%)
Mutual labels:  finance, trading
tvjs-overlays
💴 Collection of overlays made by the TradingVueJs community
Stars: ✭ 65 (-81.69%)
Mutual labels:  trading, trading-algorithms
Aiowebsocket
Async WebSocket Client. Advantage: Flexible Lighter and Faster
Stars: ✭ 263 (-25.92%)
Mutual labels:  async, asyncio
Drone Core
The core crate for Drone, an Embedded Operating System.
Stars: ✭ 263 (-25.92%)
Mutual labels:  async, real-time
Aiologger
Asynchronous logging for python and asyncio
Stars: ✭ 284 (-20%)
Mutual labels:  async, asyncio

Example HFT-ish Algorithm for Alpaca Trading API

The aim of this algorithm is to capture slight moves in the bid/ask spread as they happen. It is only intended to work for high-volume stocks where there are frequent moves of 1 cent exactly. It is one of the trading strategies based on order book imbalance. For more details about it, please refer to Darryl Shen, 2015 or other online articles.

This algorithm will make many trades on the same security each day, so any account running it will quickly encounter PDT rules. Please make sure your account balance is well above $25,000 before running this script in a live environment.

This script also presents a basic framework for streaming-based algorithms. You can learn how to write your algorithm based on the real-time price updates.

Setup

This algorithm runs with Python 3.6 or above. It uses Alpaca Python SDK so make sure install it beforehand, or if you have pipenv, you can install it by

$ pipenv install

in this directory.

API Key

In order to run this algorithm, you have to have Alpaca Trading API key. Please obtain it from the dashboard and set it in enviroment variables.

export APCA_API_KEY_ID=<your key id>
export APCA_API_SECRET_KEY=<your secret key>

Run

$ python ./tick_taker.py

The parameters are following.

  • --symbol: the stock to trade (defaults to "SNAP")
  • --quantity: the maximum number of shares to hold at once. Note that this does not account for any existing position; the algorithm only tracks what is bought as part of its execution. (Default 500, minimum 100.)
  • --key-id: your API key ID. (Can also be set via the APCA_API_KEY_ID environment variable.)
  • --secret-key: your API key secret. (Can also be set via the APCA_API_SECRET_KEY environment variable.)
  • --base-url: the URL to connect to. (Can also be set via the APCA_API_BASE_URL environment variable. Defaults to "https://paper-api.alpaca.markets" if using a paper account key, "https://api.alpaca.markets" otherwise.)

The algorithm can be stopped at any time by sending a keyboard interrupt CTRL+C to the console. (You may need to send two CTRL+C commands to kill the process depending where in the execution you catch it.)

Note

Please also note that this algorithm uses the Polygon streaming API with Alpaca API key, so you have to have a live trading account setup. For more details about the data requirements, please see Alpaca documentation.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].