forked from hpyhacking/peatio
-
Notifications
You must be signed in to change notification settings - Fork 623
Proposal for Futures Market Specs
Matas edited this page Jul 15, 2019
·
1 revision
Introduction New Data Model "Position" to record member's positions for each futures market.
# member_id :integer not null
# market_id :string(20) not null
# volume :integer default(0), not null
# margin :decimal(32, 16) default(0.0), not null
# credit :decimal(32, 16) default(0.0), not null
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 of credit
value of the opposite of the volume
. This makes
volume * avg_price + credit = 0
i.e. A filled long order of 'BTC1903` at price 3000 USD and 10 volume, with margin_rate 10%, gives
position.volume += 3
position.credit -= 3 * 3000
position.margin += about 3 * 3000 * 0.10 (depends on the current position)
And update markets
table with new columns
# base :string(255) default("spot")
# expired_at :datetime
# margin_rate :decimal(32, 16) default(0.1), not null
# maintenance_rate :decimal(2, 2) default(0.75), not null
base
specifies whether the market is of 'spot' or 'futures'.
trades are executed by transferring margins between positions and quote unit accounts, instead of funds transfers between accounts.
Peatio.tech is a Helios Technologies SAS Company. Peatio.tech