Вот сам код:
function SendOrder(direction,volume,_price,_typeOrder, comment,_instr, _id,Class)
local trans_id=_id
local transaction={
["TRANS_ID"]=tostring(trans_id),
["ACTION"]="NEW_ORDER",
["CLASSCODE"]=Class,
["SECCODE"]=_instr,
["OPERATION"]=direction,
["QUANTITY"]=string.format("%d",tostring(volume)),
["ACCOUNT"]=Account
}
transaction.type = _typeOrder
if Class=="SPBFUT" or Class=="SPBOPT" then
transaction.client_code=account
if _typeOrder=="L" then
if direction=="B" then
transaction.price=tostring(GetScalePrice(_price, _instr,Class))
else
transaction.price=tostring(GetScalePrice(_price, _instr,Class))
end
else
if direction=="B" then
transaction.price=string.format("%d",tostring(0))--tostring(TTP_Pricemax)--
else
transaction.price=string.format("%d",tostring(0))--tostring(TTP_Pricemin)--
end
end
else
transaction.client_code=client_code
if _typeOrder=="L" then
if direction=="B" then
transaction.price=tostring(GetScalePrice(_price, _instr,Class))
else
transaction.price=tostring(GetScalePrice(_price, _instr,Class))
end
else
transaction.price=string.format("%d",tostring(0))
end
end
if Class=="SPBFUT" or Class=="SPBOPT" then
transaction.client_code=tostring(account)
else
transaction.client_code=tostring(ClientCode)
end
if comment~=nil then
transaction.client_code=string.sub(transaction.client_code..'//'..tostring(comment),0,20)
else
transaction.client_code=string.sub(transaction.client_code.."//robot",0,20)
end
local res=sendTransaction(transaction)
end
Не хочет зараза опционы брать по рынку хотя с фьючами работает.