コード例 #1
0
    def broker_fx_market_order(self,
                               trade,
                               ccy1,
                               account=arg_not_supplied,
                               ccy2="USD"):
        """
        Get some spot fx data

        :param ccy1: first currency in pair
        :param ccy2: second currency in pair
        :param qty:
        :return: broker order object
        """

        ccy_code = ccy1 + ccy2
        specific_log = self.log.setup(currency_code=ccy_code)

        ibcontract = self.ib_spotfx_contract(ccy1, ccy2=ccy2, log=specific_log)
        if ibcontract is missing_contract:
            return missing_contract

        ib_BS_str, ib_qty = resolveBS(trade)
        ib_order = MarketOrder(ib_BS_str, ib_qty)
        if account != "":
            ib_order.account = account
        order_object = self.ib.placeOrder(ibcontract, ib_order)

        # for consistency with spread orders
        trade_with_contract = tradeWithContract(ibcontractWithLegs(ibcontract),
                                                order_object)

        return trade_with_contract
コード例 #2
0
ファイル: ib_fx_client.py プロジェクト: vcaldas/pysystemtrade
    def _create_fx_market_order_for_submission(
            self,
            trade: float,
            account_id: str = arg_not_supplied) -> MarketOrder:

        ib_BS_str, ib_qty = resolveBS(trade)
        ib_order = MarketOrder(ib_BS_str, ib_qty)
        if account_id is not arg_not_supplied:
            ib_order.account = account_id

        return ib_order
コード例 #3
0
ファイル: ib_contracts.py プロジェクト: zineos/pysystemtrade
def _get_ib_combo_leg(ratio, resolved_leg):
    leg = ComboLeg()
    leg.conId = int(resolved_leg.conId)
    leg.exchange = str(resolved_leg.exchange)

    action, size = resolveBS(ratio)

    leg.ratio = int(size)
    leg.action = str(action)

    return leg
コード例 #4
0
ファイル: ibClient.py プロジェクト: srravula1/pysystemtrade
    def ib_submit_single_leg_market_order(self,
                                          contract_object_with_ib_data,
                                          trade,
                                          account=""):
        ibcontract = self.ib_futures_contract(contract_object_with_ib_data)
        if ibcontract is missing_contract:
            return missing_order

        ib_BS_str, ib_qty = resolveBS(trade)
        ib_order = MarketOrder(ib_BS_str, ib_qty)
        if account != '':
            ib_order.account = account

        trade = self.ib.placeOrder(ibcontract, ib_order)

        return trade
コード例 #5
0
    def ib_submit_single_leg_market_order(self,
                                          contract_object_with_ib_data,
                                          trade,
                                          account=""):
        ibcontract = self.ib_futures_contract(contract_object_with_ib_data)
        if ibcontract is missing_contract:
            return missing_order

        ib_BS_str, ib_qty = resolveBS(trade)
        ib_order = MarketOrder(ib_BS_str, ib_qty)
        if account != '':
            ib_order.account = account
        order_object = self.ib.placeOrder(ibcontract, ib_order)

        # for consistency with spread orders
        trade_with_contract = tradeWithContract(ibcontractWithLegs(ibcontract),
                                                order_object)

        return trade_with_contract