Exemplo n.º 1
0
    def buy(self,
            owner,
            data,
            size,
            price=None,
            plimit=None,
            exectype=None,
            valid=None,
            tradeid=0,
            oco=None,
            trailamount=None,
            trailpercent=None,
            parent=None,
            transmit=True,
            **kwargs):

        order = BuyOrder(owner=owner,
                         data=data,
                         size=size,
                         price=price,
                         pricelimit=plimit,
                         exectype=exectype,
                         valid=valid,
                         tradeid=tradeid,
                         trailamount=trailamount,
                         trailpercent=trailpercent,
                         parent=parent,
                         transmit=transmit)

        order.addinfo(**kwargs)
        self._ocoize(order, oco)

        return self.submit(order)
Exemplo n.º 2
0
    def buy(self, owner, data,
            size, price=None, plimit=None,
            exectype=None, valid=None, tradeid=0, oco=None,
            trailamount=None, trailpercent=None,
            parent=None, transmit=True,
            histnotify=False, _checksubmit=True,
            **kwargs):

        order = BuyOrder(owner=owner, data=data,
                         size=size, price=price, pricelimit=plimit,
                         exectype=exectype, valid=valid, tradeid=tradeid,
                         trailamount=trailamount, trailpercent=trailpercent,
                         parent=parent, transmit=transmit,
                         histnotify=histnotify)

        orderInfo = self.fmexinterface.buy_post_only_limit_long("btcusd_p", price, 1)
        order.ref = orderInfo["data"]["id"]

        order.addinfo(**kwargs)
        self._ocoize(order, oco)

        if (orderInfo["data"]["status"] == "pending"):
            return self.submit(order, check=_checksubmit)

        return None
Exemplo n.º 3
0
    def buy(self, owner, data,
            size, price=None, plimit=None,
            exectype=None, valid=None, tradeid=0,
            **kwargs):

        order = BuyOrder(owner=owner, data=data,
                         size=size, price=price, pricelimit=plimit,
                         exectype=exectype, valid=valid, tradeid=tradeid)

        order.addinfo(**kwargs)

        return self.submit(order)
Exemplo n.º 4
0
    def buy(self, owner, data,
            size, price=None, plimit=None,
            exectype=None, valid=None, tradeid=0,
            **kwargs):

        order = BuyOrder(owner=owner, data=data,
                         size=size, price=price, pricelimit=plimit,
                         exectype=exectype, valid=valid, tradeid=tradeid)

        order.addinfo(**kwargs)

        return self.submit(order)
Exemplo n.º 5
0
    def buy(self,
            owner,
            data,
            size,
            price=None,
            plimit=None,
            exectype=None,
            valid=None,
            tradeid=0,
            oco=None,
            trailamount=None,
            trailpercent=None,
            parent=None,
            transmit=True,
            histnotify=False,
            _checksubmit=True,
            **kwargs):

        price = data.closea[0] if price is None else price

        order = BuyOrder(owner=owner,
                         data=data,
                         size=size,
                         price=price,
                         pricelimit=plimit,
                         exectype=exectype,
                         valid=valid,
                         tradeid=tradeid,
                         trailamount=trailamount,
                         trailpercent=trailpercent,
                         parent=parent,
                         transmit=transmit,
                         histnotify=histnotify)

        order.addinfo(**kwargs)
        self._ocoize(order, oco)

        return self.submit(order, check=_checksubmit)
Exemplo n.º 6
0
    def buy(self, owner, data,
            size, price=None, plimit=None,
            exectype=None, valid=None, tradeid=0,
            **kwargs):

        order = BuyOrder(owner=owner, data=data,
                         size=size, price=price, pricelimit=plimit,
                         exectype=exectype, valid=valid, tradeid=tradeid)
        order.addcomminfo(self.getcommissioninfo(data))
        order.addinfo(**kwargs)
        return self.o.order_create(order, **kwargs)