I would like to know, once a trade closes, does it dissappear out of the trades table straight away?
It seems like once a trade closes and if there is a match again, then a new trade won't open, but if I close trading station and re-open it, the trade will execute straight away. It's like closing and re-opening the app clears something?
- Code: Select all
function ExtUpdate(id, source, period)
if not(haveTrades("B")) then
...
BUY()
end
if not(haveTrades("S")) then
...
SELL()
end
end
function haveTrades(BuySell)
local enum, row;
local found = false;
enum = core.host:findTable("trades"):enumerator();
row = enum:next();
while (row ~= nil) do
if row.AccountID == Account and row.OfferID == Offer and (row.BS == BuySell or BuySell == nil) then
found = true;
break;
end
row = enum:next();
end
return found;
end