On @FTX_Official, profits are USD-settled. But traders might want to book profits in asset(s) they have as collateral

Eg BTC collateral & profits on @BitMEXdotcom

With FTX Quant Zone, I created a rule for doing just that! Here's how it works & how you can create it too!

(1/8)
I call it collateralisedProfits.

The rule finds the ratios of various types of non-USD collaterals in the wallet, & books USD profits in that ratio.

For eg. your USD profits are booked equally in BTC & ETH if you have equal $ values of ETH and BTC in your wallet

The rule 👇
Rule Trigger:

Rule triggers when the USD balance > 0 (means you have USD profits) & you have some non-USD collateral.
Action (BTC) :

Buy BTC/USD from USD profits in the required ratio of collateral. For eg. convert 1/3rd USD profits to BTC if you have equal $ amounts of BTC, ETH and BNB collateral.
Create 9 more such actions for all different kinds of collateral (ETH, USDT, FTT, BCH, LTC, BNB, PAXG, TRYB and XAUT) available on FTX presently.

See how the ETH, BCH images attached are similar to BTC action.
With this rule, you can book profits in BTC with BTC collateral as in Bitmex.

Book ETH profits with ETH collateral as on Deribit, or even create your own permutation-combinations.

Sky's the limit!
Please note:
1. Rule needs to be updated when you use a new kind of collateral which FTX has added.
2. This rule is specifically for only non-USD collaterals.
3. Test the rule on a small sub-account before making it live on big funds. DYOR.
Awesome! You can now copy this and use it in your strategies. DM or reach out to me with any questions.

Cheers!

Build it on FTX Quant Zone ---> https://ftx.com/quant-zone/ 
Update: Since the rule uses market orders, an improvement could be using offer_price() instead of price() for higher precision. See the image for how the actions would look now:

Shout out to @genoplivning for the suggestion!
You can follow @ankit_bits.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.