Loading ...

fcoin挖矿演示

Author: 爆仓小王子, Date: 2018-06-12 10:07:01
Tags: High-frequency

看到官方api群里开源的python版本,虽然很简单了,但是还有很多人架不起来环境 出问题的原因也有很多种,不太适合新手 本着开源共享的精神,我也开源一份,请大家斧正


function DealOrder(orderType, sellPrice) {
    var ticker = _C(exchange.GetTicker);
    var action = orderType == ORDER_TYPE_BUY ? 'Buy' : 'Sell';
    _C(exchange[action], (orderType == ORDER_TYPE_SELL ? sellPrice : ticker.Last), Amount);
    var recentPrice = ticker.Last;
    while (true) {
        Sleep(Wait*1000);
        var orders = _C(exchange.GetOrders);
        if (orders == 0) {
            break;
        }
        ticker = _C(exchange.GetTicker);
        _.each(orders, function(o) {
            if (o.DealAmount == 0 && ((o.Type == ORDER_TYPE_SELL && ticker.Last >= sellPrice && ticker.Last != recentPrice) || (ticker.Last != recentPrice && o.Type == ORDER_TYPE_BUY))) {
                exchange.CancelOrder(o.Id);
                recentPrice = ticker.Last
                _C(exchange[action], ticker.Last, Amount);
            }
        });
    }
    return recentPrice;
}
function main() {
    while (true) {
        DealOrder(ORDER_TYPE_SELL, DealOrder(ORDER_TYPE_BUY));
        Sleep(1000);
    }
}


Related

More

siboney 能做个COINALL的交易挖矿吗?

godspeedgld 策略有点太理想化,特别是在FCoin 卡单的时候

jiyunlj 错误 Buy(492.24, 10): timestamp is out of range 大佬,这种怎么解决啊

okfbt 謝謝大佬

winter_pig 能否加个QQ交流一下

winter_pig 用的什么交易对?