Type/to search
5
Follow
3
Followers
جب حقیقی مارکیٹ چل رہی ہو تو قیمت کے اعشاریہ کو کیسے محدود کیا جائے۔
Help
Created 2019-11-02 15:00:19  
 9
 1882

مثال کے طور پر، میں نے حال ہی میں ریئل اسٹیک کی سرگرمیوں کے بارے میں اکثر غلطی کی اطلاع دی ہے، اور شاید میں نے صرف ایک چھوٹا سا حصہ استعمال کیا ہے، براہ کرم اشارہ کریں.
img

Related Recommendations
Comment
All comments (9)
    7 years ago

    先别急着运行策略,把论坛置顶的教程大概看看吧

    7 years ago

    好的

    7 years ago

    先别急着运行策略,把论坛置顶的教程大概看看吧

    7 years ago

    exchange.Buy(_N(buyPrice,2),_N(buyAmount,3))

    7 years ago

    公开的策略一般没有特别限制精度,对不同的币种自己手动用_N设置一下

    7 years ago

    加代码在哪个位置
    比如这个抢盘口策略

    function CancelPendingOrders(orderType) {
    while (true) {
    var orders = _C(exchange.GetOrders);
    var count = 0;
    if (typeof(orderType) != 'undefined') {
    for (var i = 0; i < orders.length; i++) {
    if (orders[i].Type == orderType) {
    count++;
    }
    }
    } else {
    count = orders.length;
    }
    if (count == 0) {
    return;
    }

    for (var j = 0; j < orders.length; j++) {
    if (typeof(orderType) == 'undefined' || (orderType == orders[j].Type)) {
    exchange.CancelOrder(orders[j].Id, orders[j]);
    if (j < (orders.length-1)) {
    Sleep(Interval);
    }
    }
    }
    }
    }

    function updateProfit(accountInit, accountNow, ticker) {
    var netNow = accountNow.Balance + accountNow.FrozenBalance + ((accountNow.Stocks + accountNow.FrozenStocks) * ticker.Buy);
    var netInit = accountInit.Balance + accountInit.FrozenBalance + ((accountInit.Stocks + accountInit.FrozenStocks) * ticker.Buy);
    LogProfit(netNow - netInit);
    }

    var InitAccount = null;
    var LastBuyPrice = 0;
    var LastSellPrice = 0;

    function onTick() {
    var ticker = _C(exchange.GetTicker);
    var BuyPrice = ticker.Buy + SlidePrice;
    var SellPrice = ticker.Sell - SlidePrice;

    // 利润消失
    if ((SellPrice - BuyPrice) <= MaxDiff) {
    CancelPendingOrders();
    return;
    }

    var cancelType = null;

    if (LastBuyPrice > 0 && (ticker.Buy - LastBuyPrice) > SlidePrice) {
    cancelType = ORDER_TYPE_BUY;
    }

    if (LastSellPrice > 0 && (LastSellPrice - ticker.Sell) > SlidePrice) {
    if (cancelType == null) {
    cancelType = ORDER_TYPE_SELL;
    } else {
    cancelType = -1;
    }
    }

    if (cancelType == -1) {
    CancelPendingOrders();
    } else if (cancelType != null) {
    CancelPendingOrders(cancelType);
    }

    var orders = _C(exchange.GetOrders);
    if (orders.length == 2) {
    return;
    }
    var account = _C(exchange.GetAccount);
    var amountBuy = _N(Math.min(account.Balance / BuyPrice, Lot));
    var amountSell = Math.min(account.Stocks, Lot);

    if (amountBuy >= MinStock) {
    if (orders.length == 0 || orders[0].Type == ORDER_TYPE_SELL) {
    if (orders.length > 0) {
    updateProfit(InitAccount, account, ticker);
    }
    exchange.Buy(BuyPrice, amountBuy);
    LastBuyPrice = BuyPrice;
    }
    }
    if (amountSell >= MinStock) {
    if (orders.length == 0 || orders[0].Type == ORDER_TYPE_BUY) {
    if (orders.length > 0) {
    updateProfit(InitAccount, account, ticker);
    }
    exchange.Sell(SellPrice, amountSell);
    LastSellPrice = SellPrice;
    }
    }
    }

    function onexit() {
    CancelPendingOrders();
    }

    function main() {
    InitAccount = _C(exchange.GetAccount);
    Log(InitAccount);
    SetErrorFilter("502:|503:|unexpected|network|timeout|WSARecv|Connect|GetAddr|no such|reset|received|EOF");
    exchange.SetRate(1);
    LoopInterval = Math.max(LoopInterval, 1);
    Lot = Math.max(MinStock, Lot);
    while (true) {
    onTick();
    Sleep(LoopInterval * 1000);
    }
    }

    7 years ago

    _N(2.312,1)

    7 years ago

    基本上公开的策略好多都有这个问题,试了好几个都是这样,价格凑巧是一位小数的整数,也会成交,频繁报错,该执行买卖会执行不到位,策略完全达不到预期效果

    7 years ago
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)