LİMİT EMİR İÇİN:
import socket
clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM);
clientSocket.connect(("127.0.0.1", 18890));
data = "{" \
"\"AccountId\":\"5938\"," \
"\"BrokageId\":\"80\"," \
"\"ClientOrderId\":\"Kripex\"," \
"\"Symbol\":\"ASELS\"," \
"\"Price\":45," \
"\"Quantity\":1," \
"\"OrderSide\":1," \
"\"OrderType\":\"2\"," \
"\"IncludeAfterSession\":false," \
"\"TimeInForce\":\"0\"," \
"\"TransactionType\":\"1\"," \
"\"ApiCommands\":3}"+ chr(11);
clientSocket.send(data.encode());
dataFromServer = clientSocket.recv(5001);
print(dataFromServer.decode());
PİYASA EMRİ İÇİN:
import socket
clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM);
clientSocket.connect(("127.0.0.1", 18890));
data = "{" \
"\"AccountId\":\"5938\"," \
"\"BrokageId\":\"80\"," \
"\"ClientOrderId\":\"Kripex\"," \
"\"Symbol\":\"ASELS\"," \
"\"Price\":45," \
"\"Quantity\":1," \
"\"OrderSide\":1," \
"\"OrderType\":\"1\"," \
"\"IncludeAfterSession\":false," \
"\"TimeInForce\":\"0\"," \
"\"TransactionType\":\"1\"," \
"\"ApiCommands\":3}"+ chr(11);
clientSocket.send(data.encode());
dataFromServer = clientSocket.recv(5001);
print(dataFromServer.decode());
İki kod arasındaki tek fark OrderType parametresin değeri. Limit emir için olan kod çalışıyor ve alım yapıyor.
Piyasa emri için olan kod hata veriyor ve alım yapmıyor.
hata: (0|REJ- <-420027> : Market-price orders must be of type Fill or Kill or Fill and Kill in this trading state.)