Configuration - rapmd73/JackrabbitRelay GitHub Wiki
Configuration
Before Jackrabbit Relay is ready to run, it needs to be configured.
Configuration files
Location and file names
This would be placed in a folder called /home/JackrabbitRelay2/Config/
and
named something like ftxus.cfg
. This file would be the configuration for the FTX.US exchange.
In general, exchange/broker names follow this convention:
The name of each file is [exchangename].cfg
where [exchangename]
is the lowercase representation of your exchange/broker. In this context, an exchange and a broker are one in the same, even though there are distinct differences in methodolog of functionality. See the Exchanges.
File contents
The Jackrabbit Relay configuration files contain JSON-based text. Here is an simple example:
{ "Framework":"ccxt","Account":"MAIN","Market":"Spot","API":"YourAPI","SECRET":"YourSecret","RateLimit":"200","MaxAssets":"7" }
IMPORTANT: Because a(n) exchange/broker may support multiple accounts, or subaccounts, each configuration MUST be on a sinle line within the configuration file.
A Jackrabbit Relay echange/broker config file can be quite elaborate, based upon your needs. Here is a complete list of all of the configuration items available:
Property Name | Description |
---|---|
Framework |
This specifies which internal engine to use when processing an order for this exchange/broker. It specifically tells Jackrabbit Relay how to talk to your exchange/broker and IS required. Cryptocurrencies currently use ccxt. OANDA uses oanda. |
Account |
Every exchange/broker has at least one account. Some exchanges/brokers support sub-accounts as well. For your primary or first account, the name MUST be MAIN, case sensitive. |
API |
Your API key exactly as your exchange/broker gives it to you. Do NOT give this out to anyone. |
SECRET |
Your SECRET key exactly as your exchange gives it to you. This may also be called a bearer token (OANDA). Do NOT give this our to anyone. |
Passphrase |
This is only required for exchanges that use passphrases, such as KuCoin. Do NOT give this out to anyone. |
Market |
The market type you are trading on this account, for example: spot or future . Be sure to check supported cryptocurrency exchanges for wwhat is supported by YOUR exchange. |
RateLimit |
This is the amount Relay waits between each exchange API call. ALL EXCHANGES HAVE RATE LIMIT REQUIREMENTS.This value represent milliseconds. 1000 is one second. If you leave this out, chances are you will be banned from your exchange, most likely temporarily. You will have to tweak this number based upon your exchange/broker. |
MaxAssets |
This is the maximum number of assets that can be traded simultaneously. |
ReduceOnly |
This tells the exchange NOT to flip a position from long to short or vice-versa.It can have any value as its presence is only required. |
OrderTypeOverride |
This overrides the specified order type and applies to ALL orders on this account. |
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 |
Sandbox |
Any value accepted as its presence activates an exchange's/broker's testnet or sandbox mode or demo account. |
OverridePCTtable |
Overrides the PCT table and forces a balance percentage based upon the immediate current balance of the account for all orders on this exchange. |
RemapSymbol |
For use with the TradingView {{ticker}} macro. All orders for this account are remapped. |
CloseOnSell |
For use with the TradingView, particulatly strategies. Closes the enire position of a sell action. |
Orphan |
Any value accepted as its presence tells Jackrabbit Relay to use Oliver Twist to manage and track limit orders. This applies to ALL limit orders on this account. |
Conditional |
Designates all order on this account are conditional. Any value is accepted as its presence is all that matters. |
ConditionalOneShot |
conditional orders are allowed only ONE position. Subsequent purchases are ignored. This applies to all trading on this (sub)account. |
ConditionalRepurchase |
Special case situation for cryptocurrency exchanges ONLY. In the event the you do not have enough to fullfil an order requirement (from previous trades), this tells Oliver Twist to repurchase the amount at a better price then the original desired position. This technique is HIGH RISK and should be tested carefully. |
NoLedger |
For exchanges that produce known errors (ByBit) when trying to write ledger entries, this disables the ledger section. |
Webhook |
Many functions backfeed into Jackrabbit Relay for efficiency. This is usually the local host (127.0.0.1)and the port Jackrabbit Relay is running on. |
Identity |
This is this account's identity string. This MUST be the same for all accounts of the same name. It is optional and WILL override the main identity string in Identity.cfg . If you use an account identity, be sure to use in in your order payload as well for that account reference. |
Diagnostics |
Turn on diagnostics for extended logging. Jackrabbit Relay will become a chattering magpie and log files will grow dramatically. |
NoLiquidation |
For Mimic only. This sets Mimic wallets to spot only where liquidation won't occur, but simply error with 'not enough balance' |
Order types
Property Name | Description |
---|---|
Market |
Market order. You will pay taker fees |
Limit |
Limit order. Exchange decides what you pay (maker/taker). Unlike market orders, limit order have a high rate of failure. |
LimitTaker |
Limit order. You pay taker fee, This is a fill or kill order, usful only on some crypto exchanges. |
LimitMaker |
Limit order. You pay maker fee. Mat or may not be respected by a given exchange. Some exchanges only allow 25% of your orders to be maker orders. |
Examples for the CCXT framework
Note: KuCoin requires a passphrase as well. It is case sensitive and must be
EXACTLY as you gave it to KuCoin (/home/JackrabbitRelay2/Config/kucoin.cfg
). Here is an example:
{ "Framework":"ccxt","Account":"MAIN","API":"YourAPI","SECRET":"YourSecret","Passphrase":"YourPassphrase","RateLimit":"1000","MaxAssets":"7","ReduceOnly":"Yes", "Orphan":"Yes","RemapSymbol":"Yes","Webhook":"http://127.0.0.1:12345" }
Jackrabbit Relay supports multiple API keys per exchange (sub)account. This is accomplished by this format:
{ "Framework":"ccxt","Account":"MAIN","API 1":"YourAPI","SECRET 1":"YourSecret","RateLimit":"200" }
{ "Framework":"ccxt","Account":"MAIN","API 2":"YourAPI","SECRET 2":"YourSecret","RateLimit":"200" }
The above means the your MAIN account has two API/SECRET combinations that Relay will rotate between. You can have as many (sub)account API/SECRETs as your exchange will allow. Jackrabbit Relay automatically supports and uses API rotation where allowed.
Examples for the OANDA framework
Please be sure to watch this brief overview of OANDA.
The OANDA brokerage is unique in that the bearer-token or API must be recreated with each new subaccount you add to your broker's account list. Also, there is NO secret key with OANDA. The API applies to ALL (sub)accounts. Please pay particular attention to your AccountID as it will be diffent for each (sub)account.
# Demo accounts
# Short positions - Aggressive
{ "Framework":"oanda","RateLimit":"20","Sandbox":"Yes","Account":"LemonMeringue","AccountID":"001-001-1234567489-001","API":"Bearer-Token","Webhook":"http://127.0.0.1:7890" }
# Long positions - Aggressive
{ "Framework":"oanda","RateLimit":"20","Sandbox":"Yes","Account":"StrawberryDelight","AccountID":"001-001-123456789-002","API":"Bearer-Token","Webhook":"http://127.0.0.1:7890" }
# Short positions - Defensive
{ "Framework":"oanda","RateLimit":"20","Sandbox":"Yes","Account":"FrenchVanilla","AccountID":"001-001-123456789-003","API":"Bearer-Token","Webhook":"http://127.0.0.1:7890" }
# Long positions - Defensive
{ "Framework":"oanda","RateLimit":"20","Sandbox":"Yes","Account":"BlueberryCobbler","AccountID":"001-001-123456789-004","API":"Bearer-Token","Webhook":"http://127.0.0.1:7890" }
# OANDA live account
# Short positions
{ "Framework":"oanda","RateLimit":"20","Account":"CherryBlossom","AccountID":"001-001-123456789-001","API":"Bearer-Token","Webhook":"http://127.0.0.1:7890" }
# Long positions
{ "Framework":"oanda","RateLimit":"20","Account":"Cheesecake","AccountID":"001-001-123456789-002","API":"Bearer-Token","Webhook":"http://127.0.0.1:7890" }
Please be aware the 20 milliseconds is the lowest ratelimit you can use without getting your orders throttled. The webhook MUST match YOUR system setup.