Transpiled version (10780L) is out of date.
interface IFuturesMarket { // all open/close orders are market right now (not limit) sclass OpenOrCloseOrder { // input parameters settable S clientOrderID; // optional settable HoldSide holdSide; settable double cryptoAmount; // Limit order if set. Otherwise market order. // Limit orders are good-until-cancel. // (unimplemented) settable double limitPrice = Double.NaN; // output parameters // order ID returned by platform settable S orderID; } macro ExtendingOpenOrCloseOrder { public selfType clientOrderID(S clientOrderID) { super.clientOrderID(clientOrderID); this; } public selfType holdSide(HoldSide holdSide) { super.holdSide(holdSide); this; } public selfType cryptoAmount(double cryptoAmount) { super.cryptoAmount(cryptoAmount); this; } public selfType limitPrice(double limitPrice) { super.limitPrice(limitPrice); this; } } sclass OpenOrder extends OpenOrCloseOrder { ExtendingOpenOrCloseOrder settable double leverage = 1; settable bool isCross; } sclass CloseOrder extends OpenOrCloseOrder { ExtendingOpenOrCloseOrder } // throws exception if order failed void openPosition(OpenOrder order); // throws exception if order failed void closePosition(CloseOrder order); sclass SwappableImplementation is IFuturesMarket { public swappable void openPosition(OpenOrder order) {} public swappable void closePosition(CloseOrder order) {} public swappable double drift() { unimplemented(); } public FutureCoinParameters getCoinParameters() { unimplemented(); } } // Get current drift (sum of longs+shorts in crypto units) double drift(); FutureCoinParameters getCoinParameters(); }
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1036219 |
Snippet name: | IFuturesMarket - interface to a single market (e.g. ETHUSDT) |
Eternal ID of this version: | #1036219/18 |
Text MD5: | bce36ec4a88f40f3865285794bddaf6d |
Author: | stefan |
Category: | javax / trading |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2023-11-02 18:25:54 |
Source code size: | 1823 bytes / 57 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 122 / 221 |
Version history: | 17 change(s) |
Referenced in: | [show references] |