Closed hardywu closed 1 year ago
@mod
Ideally this feature could be pluggable or have the ability to disable
Futures Market is enabled by setting base of the market to 'future'.
Do you think it's achievable to make a table of "Futures" orders that will be specifically Futures ?
Try to reuse the current order matching engine. A new table of "Futures' orders may requires Multiple Table Inheritance. Haven't try it yet. How would the benefits be based on your estimation?
@hardywu Good job Bro. Thanks for sharing
@mod
Ideally this feature could be pluggable or have the ability to disable
Futures Market is enabled by setting base of the market to 'future'.
Can both markets (spot and futures) be served at the same time since both depends on the same market data? How to enable future market in trading-ui?
Do you think it's achievable to make a table of "Futures" orders that will be specifically Futures ?
Try to reuse the current order matching engine. A new table of "Futures' orders may requires Multiple Table Inheritance. Haven't try it yet. How would the benefits be based on your estimation?
From business perspective, Peatio usage will get bigger commercial coverage since existing futures companies can also now adopt Peatio in their portfolios. On top of it, the prices of cryptocurrencies, esp. Bitcoin, are relatively higher than those of stocks.
Can both markets (spot and futures) be served at the same time since both depends on the same market data? How to enable future market in trading-ui?
Spots and futures markets depend on different market data, but serving futures market for existing spots market is a must-to-have feature for professional traders. Both kinds of markets can share the same UI.
From business perspective, Peatio usage will get bigger commercial coverage since existing futures companies can also now adopt Peatio in their portfolios. On top of it, the prices of cryptocurrencies, esp. Bitcoin, are relatively higher than those of stocks.
I implement this feature because all traders I talked to consider spots only markets are for individual "investors" only.
for pull request #1884 @ysv proposal at wiki page wiki at https://github.com/rubykube/peatio/wiki/Proposal-for-Futures-Marktet-Specs
schema change
Introduction New Data Model "Position" to record member's positions for each futures market.
margin
store the margin value subs from quote unit account.credit
store the sum of the values of the orders that build up the position in quote unit. Keep the sign ofcredit
value of the opposite of thevolume
. This makesi.e. A filled long order of 'BTC1903` at price 3000 USD and 10 volume, with margin_rate 10%, gives
And update
markets
table with new columnsbase
specifies whether the market is of 'spot' or 'futures'.