Leexchange.SetDirection()
Cette fonction est utilisée pour définir la direction des ordres de la fonction {@fun/Trade/exchange.Buy exchange.Buy}, {@fun/Trade/exchange.Sell exchange.Sell} lors de la passation d'ordres pour les contrats à terme.
Je suis en train de changer de direction.
Ledirection
Le paramètre est utilisé pour définir la direction du contrat à terme lorsque l'ordre est passé."buy"
, "closesell"
, "sell"
, "closebuy"
- Je ne sais pas.
direction
vrai
chaîne
function main(){
// For example, set to OKX futures contract of this week
exchange.SetContractType("this_week")
// Set leverage to 5 times
exchange.SetMarginLevel(5)
// Set the order type to long
exchange.SetDirection("buy")
// Place an order for 2 contracts at 10,000
exchange.Buy(10000, 2)
exchange.SetMarginLevel(5)
exchange.SetDirection("closebuy")
exchange.Sell(1000, 2)
}
def main():
exchange.SetContractType("this_week")
exchange.SetMarginLevel(5)
exchange.SetDirection("buy")
exchange.Buy(10000, 2)
exchange.SetMarginLevel(5)
exchange.SetDirection("closebuy")
exchange.Sell(1000, 2)
void main() {
exchange.SetContractType("this_week");
exchange.SetMarginLevel(5);
exchange.SetDirection("buy");
exchange.Buy(10000, 2);
exchange.SetMarginLevel(5);
exchange.SetDirection("closebuy");
exchange.Sell(1000, 2);
}
Leexchange.SetDirection()
la fonction définit la correspondance entre la direction de l'opération du contrat à terme et la fonction de placement des ordres:
Fonctions de placement des commandes | La direction définie par les paramètres de la fonction SetDirection | Les commentaires |
---|---|---|
exchange.Buy | Achat et ouverture de positions longues | |
exchange.Buy | Achat et fermeture de positions courtes | |
exchange.Sell | Vendre et ouvrir des positions courtes | |
exchange.Sell | Vendre et fermer des positions longues |
{@fun/Trade/exchange.Buy exchange.Buy}, {@fun/Trade/exchange.Sell exchange.Sell}, {@fun/Trade/exchange.Sell exchange.Sell}, {@fun/Trade/exchange.Buy exchange.Buy}, {@fun/Trade/exchange.Sell exchange.Sell}, {@fun/Trade/exchange.Sell exchange.Sell}, {@fun/Trade/exchange.Sell exchange.Sell}, {@fun/Trade/exchange.Sell exchange.Sell}, {@fun/Trade/exchange.Sell exchange.Sell}, {@fun/Trade/exchange.Sell}, {@fun/Trade/exchange.Buy exchange.Sell}, {@fun/Trade/exchange.Buy exchange.Buy exchange.Buy.Buy}, {@fun/Trade/exchange.Buy.Buy.Buy}, {@fun/Trade/Exchange.Buy.Buy}
exchange.SetMarginLevel exchange.SetContractType