Skip to content

Commit

Permalink
infrastructure for comissoin
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Carver committed Mar 19, 2024
1 parent c06f13b commit 9e62731
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
20 changes: 20 additions & 0 deletions sysbrokers/broker_contract_commission_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@


from sysdata.futures.contracts import futuresContractData
from sysdata.data_blob import dataBlob
from sysobjects.contracts import futuresContract

from syslogging.logger import *


class brokerFuturesContractCommissionData(futuresContractData):
def __init__(self, data: dataBlob, log=get_logger("brokerFuturesContractCommissionData")):
super().__init__(log=log)
self._data = data

def get_commission_for_contract(self, contract: futuresContract) -> float:
raise NotImplementedError

@property
def data(self):
return self._data
3 changes: 3 additions & 0 deletions sysbrokers/broker_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from sysbrokers.IB.ib_orders import ibExecutionStackData
from sysbrokers.IB.ib_static_data import ibStaticData
from sysbrokers.IB.ib_fx_handling import ibFxHandlingData
from sysbrokers.IB.ib_broker_commissions import ibFuturesContractCommissionData

from syscore.objects import resolve_function
from sysdata.data_blob import dataBlob

Expand Down Expand Up @@ -43,4 +45,5 @@ def get_ib_class_list():
ibCapitalData,
ibFuturesInstrumentData,
ibFxHandlingData,
ibFuturesContractCommissionData
]
7 changes: 7 additions & 0 deletions sysproduction/data/broker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from copy import copy

from sysbrokers.broker_contract_commission_data import brokerFuturesContractCommissionData
from sysbrokers.broker_factory import get_broker_class_list
from sysbrokers.broker_fx_handling import brokerFxHandlingData
from sysbrokers.broker_static_data import brokerStaticData
Expand Down Expand Up @@ -93,11 +94,17 @@ def broker_fx_handling_data(self) -> brokerFxHandlingData:
def broker_static_data(self) -> brokerStaticData:
return self.data.broker_static

@property
def broker_futures_contract_commission(self) -> brokerFuturesContractCommissionData:
return self.data.broker_futures_contract_commission

@property
def diag_controls(self) -> diagControlProcess:
return self._diag_controls

## Methods
def get_commission_for_contract(self, contract: futuresContract) -> float:
return self.broker_futures_contract_commission.get_commission_for_contract(contract)

def get_list_of_contract_dates_for_instrument_code(
self, instrument_code: str, allow_expired: bool = False
Expand Down

0 comments on commit 9e62731

Please sign in to comment.