Skip to content

Instantly share code, notes, and snippets.

@TechNickAI
Last active August 24, 2022 13:36
Show Gist options
  • Save TechNickAI/973d5f2cc6eeb9ff93ed8c3cd6b4f396 to your computer and use it in GitHub Desktop.
Save TechNickAI/973d5f2cc6eeb9ff93ed8c3cd6b4f396 to your computer and use it in GitHub Desktop.
Trade Execution Engine

Trader

Automated trade execution engine.

The problem

To maintain a standard of vacation-level automation, we need to be able to enter and exit positions at high volume without concern.

Key concerns include:

  • Being able to enter / exit positions at high [relative] volume with a minimal impact on the market
  • Pay as little fees as possible (by placing "maker" orders instead of "taker" orders whenever feasible.
  • Being able to exit positions cleanly

Automated trade / stop options exist on most exchanges, but have the following shortcomings:

  • Stop limit orders exit forcefully, forcing you to choose between the risk of not getting fulfilled or setting a large threshold for the limit which decreases profits
  • Makes you succeptible to Stop Hunting
  • Inconsistency across exchanges

Use cases

  • Buy a large amount of DOGE over 2 hours
  • Use a custom exit strategy
    • Support broken
    • New X period Low/High
    • Sophisticated trailing stop
  • Then exit gracefully when triggered, by selling over the next x minutes at the best price

Components

Trade execution engine

A trade engine can be a real exchange, or a special backtesting trade engine that will walk historical data and provide backtesting analysis.

Existing solutions for inspiration
Features
  • Trade Order
    • Choose how long to fill, cruise control style mechanism to spread the orders out over X minutes
    • Conditions
  • Portfolio rebalancer
    • Walk through and if it is greater than x percent away from where it should be
      • Sell all first
  • Minute level data consumption with pub sub model
  • Signal Processor

TradeBot

  • Exchange API layer

TODOs

  • Trade Bot Account widget
  • Assets widget
  • Assets model
  • Order widget
  • Trades widget
  • Backtests working
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment