As a growing lobster, I'm confused by the combination of directional choices and buy and sell orders in platform futures trading.
SetDirection ((buy/sell/closebuy/closesell), a total of four trading directions Then, call the exchange.Buy/Sell function to place the order.
The following are some combinations of situations that can get complicated: Buy and sell under the direction of buybuy Buy and sell in the sell direction Buy and sell under the closebuy direction The buy and sell buttons under the closesell direction, respectively, are understood, after manual testing with a different method. I have come to the following conclusion: Conclusion 1: Whether the current direction is buy or sell, the over-position is buy, the open position is sell. Conclusion 2: Whether the direction is closebuy or closeesell, the plain is sell, the empty is buy.
For smaller cabbage references, the test's cabbage code is as follows:
/*backtest start: 2018-12-01 00:00:00 end: 2018-12-31 00:00:00 period: 1h exchanges: [{“eid”:“Futures_OKCoin”,“currency”:“BTC_USD”}] */
function main() { exchange.SetContractType(“quarter”) exchange.SetMarginLevel(10) exchange.SetDirection(“sell”) var buy1 =exchange.GetTicker() Log(buy1.Sell) exchange.Sell(3500,500) Log(exchange.GetAccount()); Log(exchange.GetPosition()); exchange.SetDirection(“closebuy”) exchange.Buy(4000,500) Log(exchange.GetAccount()); Log(exchange.GetPosition());
}
//buy sell // [{“Price”:3934.21,“Amount”:500,“FrozenAmount”:0,“Profit”:-0.00003230381575061599,“Margin”:1.27090318,“MarginLevel”:10,“Type”:1,“ContractType”:“quarter”}] // {“Balance”:0,“FrozenBalance”:0,“Stocks”:98.72528411046,“FrozenStocks”:0}
//buy buy // [{“Price”:3934.23,“Amount”:500,“FrozenAmount”:0,“Profit”:-0.00003230365153283115,“Margin”:1.27089671,“MarginLevel”:10,“Type”:0,“ContractType”:“quarter”}] // {“Balance”:0,“FrozenBalance”:0,“Stocks”:98.725290599843,“FrozenStocks”:0}
//sell sell //[{“Price”:3934.21,“Amount”:500,“FrozenAmount”:0,“Profit”:-0.00003230381575061599,“Margin”:1.27090318,“MarginLevel”:10,“Type”:1,“ContractType”:“quarter”}] //{“Balance”:0,“FrozenBalance”:0,“Stocks”:98.72528411046,“FrozenStocks”:0}
//sell buy //[{“Price”:3934.23,“Amount”:500,“FrozenAmount”:0,“Profit”:-0.00003230365153283115,“Margin”:1.27089671,“MarginLevel”:10,“Type”:0,“ContractType”:“quarter”}] //{“Balance”:0,“FrozenBalance”:0,“Stocks”:98.725290599843,“FrozenStocks”:0}
//--------------------------------------------------------------------------- //buy buy //[{“Price”:3934.23,“Amount”:500,“FrozenAmount”:0,“Profit”:-0.00003230365153283115,“Margin”:1.27089671,“MarginLevel”:10,“Type”:0,“ContractType”:“quarter”}] // {“Balance”:0,“FrozenBalance”:0,“Stocks”:1.725290599843,“FrozenStocks”:0} //sell buy //[{“Price”:3934.23,“Amount”:500,“FrozenAmount”:0,“Profit”:-0.00003230365153283115,“Margin”:1.27089671,“MarginLevel”:10,“Type”:0,“ContractType”:“quarter”}] //{“Balance”:0,“FrozenBalance”:0,“Stocks”:1.725290599843,“FrozenStocks”:0}
// buy and sell
//{
// Currently holding more positions So, what's the difference? // closebuy buy // invalid position // closebuy sell I'm not sure. //{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{{{{{{
// closeesell buy // invalid position // closeesell sell I'm not sure. //{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{{{{{{ So, what's the difference? // Conclusion: whether the direction is closebuy or closeesell, it's mostly sell
// current hold So, what's the difference? // closeesell sell // invalid position // closeesell buy I'm not sure. //{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{{{{{{
// closebuy sell // invalid position // closebuy buy I'm not sure. //{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{\pos (190,190) }{{{{{{ // Conclusion: whether the direction is closebuy or closeesell, the price is buy
Inventors quantify - small dreamsThe following functions are set to the following instructions. I'm not going to lie to you. Exchange.Buy is a multi-position exchange.SetDirection ("buy") and close-sell exchange.SetDirection ("closesell") are all buy positions, but one is an open position and one is a close-sell. Exchange.Sell is a four-way cryptocurrency futures market, with commodity futures also dealing with the current market.
NightskyWhat platform is this?
Cost of materialsexchange.SetDirection In digital currency futures setting four directions closesell sell corresponds to exchange.Sell, closebuy buy corresponds to exchange.Buy.
Cost of materials :)
fengokI see!
Inventors quantify - small dreamsBITMEX, the BITMEX perpetual contract, is similar to the concept of spot, only buying and selling, if it's other futures exchanges like OKEX, you have to use a plain multiple plain blank to get a plain.
fengokI also have this question right now, all of the sell buy is for open positions and close is not useless.
fengokHow do you understand these four buttons now?
fengokI'm also wondering now, what are the four directions that work in? I set up buy sell, and it's all done, whether it's open or closed, and closebuy and close-sell are not useless?
Cost of materialsOkayx futures simulated retesting