-
-
Notifications
You must be signed in to change notification settings - Fork 18
Orders
This document details the various types of order payloads or messages with example. These messages are what help platforms like TradingView talk to Jackrabbit Relay. Jackrabbit Relay converts this information into an orer for your desired exchange.
Description of the payload items
Property Name | Description |
---|---|
Identity |
The identity string from the main Identity.cfg or the one from the exchange config file, if one is used. This element is REQUIRED for all orders. |
Exchange |
This is one or more of the supported exchanges Relay supports virtual exchanges/brokers, like the DSR, so they can be supplied here. for example, "dsr,kucoin". A virtual exchange is an order modifier process to enhance or provide extra analysis. |
Market |
This is the market you are trading. Spot , Future , Margin . Only applies to cryptocurrency markets. |
Account |
All main accounts must be called MAIN . Subaccounts can be used (if your exchange supports them) and must be exactly as listed on the exchange. If you use multiple exchanges, accounts must be listed in the same order as the exchanges. See the DSR for am example. |
OrderType |
This is one of the allowed order types |
Action |
This is one of the supported actions |
Asset |
The asset you are trading. Must be exactly as the exchange lists it. Hint: Use ListMarkets to confirm |
USD / Base / Quote / Units
|
Choose only one to set the amount to be purchased/sold:USD will only work if the asset has a corresponding USD pair to do a proper base conversion on.Base is the asset itself value, ie BTC, ADA, AAVE, so one. A base of 1 for BTC is to purchase 1 BTC.Quote is the value of the asset in its quote currency. For example, if you want to purchase BCH/BTC using the price value of BTC, then you specify your amount in the quote currency.The amount can be expressed in percentage form, which will reflct the percentage ofthe balance of the account. Values expressed in percentage form can also denote base or quote currency volumes: 12%b ), the base value is kept consistent throught the trade cycle while the quote currwency volume depreciates.12%q ), the quote currency value is kept consistent while the base currency value appreciates.Units is the number of units you want to purchase. Only applies to Forex and must be whole numbers |
Price |
For limit orders. This value can be bid , ask , or a value. If this is not present, the current closing price is used. |
Leverage |
For binanceusdm and ftx, this sets the leverage amount |
Margin |
For binanceusdm, this sets the margin to Crossed or Isolated . |
ReduceOnly |
Prevents position flipping on exchanges/brokers that allow it. |
Reduction |
The amount to reduce your position to all your exchange to close it. This is a percentage. Do NOT put a percent (%) sign. Use this ONLY if you receive errors closing a position. Finding the amount of the reduction is strictly trial and error. |
Spread |
This evaluate the difference between the bid and ask prices. Trades are only places if the spread is under this value |
OverridePCTtable |
Overrides thew PCT table and forces a balance percentage based upon the immediate current balance of the account |
OverrideMaxAssets |
Override the MaxAssets setting from the account configuration for THIS order only. |
RemapSymbol |
For use with the TradingView {{ticker}} macro. Only this order is remapped. Applies to THIS order only. |
CloseOnSell |
For use with the TradingView, particularly strategies. Closes the enire position of a sell action. Applies to THIS order only. |
Orphan |
Uses OliverTwist to manage and track limit orders. Applies to THIS order only. |
Conditional |
Designates THIS order on this account is conditional. Any value is accepted as its presence is all that matters. |
ConditionalOneShot |
THIS conditional order is allowed only ONE position. Subsequent purchases are ignored. |
LedgerNotes |
This is a note about this trade that is recorded in the ledger once the trade is filled. Can be any text you want, as long as it doesn't break the JSON format. |
Type | Description |
---|---|
Market |
Market Orders. You pay taker fees on both sides of the trade and this order completes immediately. This is the default if order type is not present and the exchange supports market orders. |
Limit |
Limit Orders. You will pay either a maker fee or a taker fee based upon how long this order sits on the books. This is the default for exchanges that do not support market orders. |
LimitMaker |
Limit Orders with a request to hold this order on the book for a maker fee. |
LimitTaker |
Limit Orders with a fill or kill request. You will pay a taker fee. This order type is a simulated effect of a market order for exchanges that only support limit orders. |
Action | Description |
---|---|
Buy |
Purchase an asset. |
Sell |
Sell a portion of asset. If amount is more than balance, the full position will be closed. |
Close |
Sell all of the asset. |
Long |
(Perpetuals) Opens a long position, and can flip a short to long (if ReduceOnly is not included in configuration). |
Short |
(Perpetuals) Opens a short position, and can flip a long to short (if ReduceOnly is not included in configuration). |
Here are examples of the payload. Payloads can be on a single line or spread acros multiple lines. The format below is multiple lines for readability.
This example of a gewneralized payload for TradingView that uses the {{ticker}}
macro and requires the SymbolRemap to tell Relay to look up the asset from the TV2Exchange
remap file.
{
"Exchange":"binance",
"Market":"Spot",
"Account":"MAIN",
"Action":"Buy",
"Asset":"{{ticker}}",
"SymbolRemap":"Yes",
"USD":"30",
"Identity":"YourIdentityString"
}
This example purchased $30 of AAVE on the FTX US exchange.
{
"Exchange":"ftxus",
"Market":"Spot",
"Account":"MAIN",
"Action":"Buy",
"Asset":"AAVE/USD",
"USD":"30",
"Identity":"YourIdentityString"
}
This example purchases the minimum amount of AAVE in USD. The minimum amount is defined by the exchange.
{
"Exchange":"ftxus",
"Market":"Spot",
"Account":"MAIN",
"Action":"Buy",
"Asset":"AAVE/USD",
"Identity":"YourIdentityString"
}
This example sells $7 of AAVE
{
"Exchange":"ftxus",
"Market":"Spot",
"Account":"MAIN",
"Action":"Sell",
"Asset":"AAVE/USD",
"USD":"7",
"Identity":"YourIdentityString"
}
This example sells th exchange minimum of AAVE
{
"Exchange":"ftxus",
"Market":"Spot",
"Account":"MAIN",
"Action":"Sell",
"Asset":"AAVE/USD",
"Identity":"YourIdentityString"
}
This example close out or sells all of AAVE
{
"Exchange":"ftxus",
"Market":"Spot",
"Account":"MAIN",
"Action":"Close",
"Asset":"AAVE/USD",
"Identity":"YourIdentityString"
}
This example purchases AAVE using its base value, in this case, 1 AAVE
{
"Exchange":"kraken",
"Market":"Spot",
"Account":"MAIN",
"Action":"Buy",
"Asset":"AAVE/USD",
"Base":"1",
"Identity":"YourIdentityString"
}
This example purchases BCH by the value of BTC
{
"Exchange":"ftx",
"Market":"Spot",
"Account":"MAIN",
"Action":"Buy",
"Asset":"BCH/BTC",
"Quote":"1",
"Identity":"YourIdentityString"
}
This example purchases BCH by the value of BTC using a limit MAKER order
{
"Exchange":"ftx",
"Market":"Spot",
"Account":"MAIN",
"Action":"Buy",
"Asset":"BCH/BTC",
"Quote":"1",
"OrderType":
"LimitMaker",
"Close":"ASK",
"Identity":"YourIdentityString"
}
This example purchase of a perpetual contract of AAVE with a leverage of 5
{
"Exchange":"ftx",
"Market":"Future",
"Account":"MAIN",
"Action":"Buy",
"Asset":"AAVE/USD:USD",
"Base":"1",
"Leverage":"5",
"Identity":"YourIdentityString"
}
This example purchase of a perpetual contract of AAVE with a leverage of 20, using an isolated margin.
{
"Exchange":"ftx",
"Market":"Future",
"Account":"MAIN",
"Action":"Buy",
"Asset":"AAVE/USD:USD",
"Base":"1",
"Leverage":"20",
"Margin":"Isolated",
"Identity":"YourIdentityString"
}
This example will purchase 1% of the total value of the account using the USD conversion amount. Market order is assumed.
{
"Exchange":"kucoin",
"Market":"Spot",
"Account":"MAIN",
"Action":"Buy",
"Asset":"ADA/USDT",
"USD":"1%",
"Identity":"YourIdentityString"
}
This example closes the above. It is important to remember to maintain the percentage reference in closing a position. Relay only checks its internal tables as needed to retain maximum effecincy. That means you must explicitly tell it what tables to check.
{
"Exchange":"kucoin",
"Market":"Spot",
"Account":"MAIN",
"Action":"Close",
"Asset":"ADA/USDT",
"USD":"1%",
"Identity":"YourIdentityString"
}
Please note that Jackrabbit Relay is not related to the Apache Jackrabbit project. Jackrabbit Relay is a standalone framework and API delivery system for automated algorithmic trading, designed for relaying JSON payloads that contain buy/sell order information between different systems (Charting software, forex brokers, cryptocrrency exchanges using REST). It is developed by Robert Darin and is not affiliated with or endorsed by the Apache Software Foundation or the Apache Jackrabbit project.
If you would like to help support this project financially, please click on the heart shaped sponsor's button in the right column of this page. I also have a merch store with some awesome and really cool products. Please visit supporting Jackrabbit for more options.
All subscriptions/sales go to the costs of sustaining Jackrabbit Relay. Thank you.
RAPMD Crypto: Automated algorithmic trading done right
Frequency Weighted OrderBook Analysis
Introduction
Jackrabbit Relay
Introduction
Risks
Disclaimer
Notes
Video
Supported Exchanges/Brokers
Security and firewall
Installation
Updating
Configuration files
Live Trading
Installation-and-Setup
Installation/Setup
Requirements
Stopping Version 1
Installing and setting up Version 2
Configuration
Reboot startup
Manual startup
Configuration
Configuration
Configuration files
Location and file names
File contents
Order types
Examples for the CCXT framework
Examples for the OANDA framework
Conditional Orders
JackrabbitRelay Order Payloads
Oliver Twist: Jackrabbit Relay conditional and orphan order manager
Unveiling Oliver Twist's Conditional Methodology
Managing Orphan Orders: The Limit-Only Approach
The Literary Significance of "Oliver Twist"
Supported-Exchanges-and-Brokers
Supported Exchanges/Brokers
Forex Brokers
Confirmed working brokers
Cryptocurrency Exchanges
Confirmed working exchanges
Theoretically supported
Known-Issues
Known Issues
Closing a position fails
BitMex
Phemex
ByBit
Python 3.10
Kucoin Futures/TradingView
Jackrabbit-Mimic
Jackrabbit Mimic
Introduction
Usage
Data Source Integration
Simple Setup Process
Understanding Differences
Educational Focus
Setup and Configuration
Wallets and history
How cryptocurrency wallets work
Long positions
Short positions
Alert/Signal messages
Long positions
Short positions
Supporting Jackrabbit Mimic
Testing-TradingView-connection
Testing TradingView connection
Testing method
Setup
DSR Testing
Force feeding payloads
Next Steps
Step-by-step guide to live trading with TradingView
Step-by-step guide to live trading with TradingView
Walk Through
Strategy Differences