Skip to content

Commit

Permalink
adding infrastructure for commission collection script
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Carver committed Mar 19, 2024
1 parent 05184ea commit cfab929
Show file tree
Hide file tree
Showing 23 changed files with 456 additions and 26 deletions.
51 changes: 51 additions & 0 deletions data/futures/roll_calendars_csv/BTC*SPREAD.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
DATE_TIME,current_contract,next_contract,carry_contract
2019-09-20 00:00:00,20190900,20191000,20190800
2019-09-27 00:00:00,20191000,20191100,20190900
2019-11-21 00:00:00,20191100,20191200,20191000
2019-12-20 00:00:00,20191200,20200100,20191100
2019-12-27 02:00:00,20200100,20200200,20191200
2020-01-31 00:00:00,20200200,20200300,20200100
2020-02-27 12:00:00,20200300,20200400,20200200
2020-03-27 00:00:00,20200400,20200500,20200300
2020-04-24 00:00:00,20200500,20200600,20200400
2020-05-29 00:00:00,20200600,20200700,20200500
2020-06-26 00:00:00,20200700,20200800,20200600
2020-07-31 00:00:00,20200800,20200900,20200700
2020-08-28 00:00:00,20200900,20201000,20200800
2020-09-25 00:00:00,20201000,20201100,20200900
2020-10-30 00:00:00,20201100,20201200,20201000
2020-11-27 00:00:00,20201200,20210100,20201100
2020-12-24 00:00:00,20210100,20210200,20201200
2021-01-29 00:00:00,20210200,20210300,20210100
2021-02-26 00:00:00,20210300,20210400,20210200
2021-03-26 00:00:00,20210400,20210500,20210300
2021-04-30 00:00:00,20210500,20210600,20210400
2021-05-28 00:00:00,20210600,20210700,20210500
2021-06-25 00:00:00,20210700,20210800,20210600
2021-07-30 00:00:00,20210800,20210900,20210700
2021-08-27 00:00:00,20210900,20211000,20210800
2021-09-24 00:00:00,20211000,20211100,20210900
2021-10-29 00:00:00,20211100,20211200,20211000
2021-11-26 00:00:00,20211200,20220100,20211100
2021-12-31 00:00:00,20220100,20220200,20211200
2022-01-28 00:00:00,20220200,20220300,20220100
2022-02-25 00:00:00,20220300,20220400,20220200
2022-03-25 00:00:00,20220400,20220500,20220300
2022-04-29 00:00:00,20220500,20220600,20220400
2022-05-27 00:00:00,20220600,20220700,20220500
2022-06-24 00:00:00,20220700,20220800,20220600
2022-07-29 00:00:00,20220800,20220900,20220700
2022-08-26 00:00:00,20220900,20221000,20220800
2022-09-30 00:00:00,20221000,20221100,20220900
2022-10-28 00:00:00,20221100,20221200,20221000
2022-11-25 00:00:00,20221200,20230100,20221100
2022-12-30 00:00:00,20230100,20230200,20221200
2023-01-27 00:00:00,20230200,20230300,20230100
2023-02-24 00:00:00,20230300,20230400,20230200
2023-03-31 00:00:00,20230400,20230500,20230300
2023-04-28 00:00:00,20230500,20230600,20230400
2023-05-26 06:00:00,20230600,20230700,20230500
2023-06-30 02:00:00,20230700,20230800,20230600
2023-07-28 01:00:00,20230800,20230900,20230700
2023-08-25 00:00:00,20230900,20231000,20230800
2023-09-29 00:00:00,20231000,20231100,20230900
51 changes: 51 additions & 0 deletions data/futures/roll_calendars_csv/BTC*SPREAD2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
DATE_TIME,current_contract,next_contract,carry_contract
2019-09-02,20190900,20191000,20190800
2019-09-20,20191000,20191100,20190900
2019-10-25,20191100,20191200,20191000
2019-11-29,20191200,20200100,20191100
2019-12-23,20200100,20200200,20191200
2020-01-22,20200200,20200300,20200100
2020-02-20,20200300,20200400,20200200
2020-03-23,20200400,20200500,20200300
2020-04-21,20200500,20200600,20200400
2020-05-22,20200600,20200700,20200500
2020-06-22,20200700,20200800,20200600
2020-07-22,20200800,20200900,20200700
2020-08-21,20200900,20201000,20200800
2020-09-21,20201000,20201100,20200900
2020-10-22,20201100,20201200,20201000
2020-11-20,20201200,20210100,20201100
2020-12-22,20210100,20210200,20201200
2021-01-22,20210200,20210300,20210100
2021-02-19,20210300,20210400,20210200
2021-03-22,20210400,20210500,20210300
2021-04-21,20210500,20210600,20210400
2021-05-21,20210600,20210700,20210500
2021-06-21,20210700,20210800,20210600
2021-07-22,20210800,20210900,20210700
2021-08-23,20210900,20211000,20210800
2021-09-21,20211000,20211100,20210900
2021-10-22,20211100,20211200,20211000
2021-11-22,20211200,20220100,20211100
2021-12-22,20220100,20220200,20211200
2022-01-21,20220200,20220300,20220100
2022-02-18,20220300,20220400,20220200
2022-03-22,20220400,20220500,20220300
2022-04-21,20220500,20220600,20220400
2022-05-23,20220600,20220700,20220500
2022-06-21,20220700,20220800,20220600
2022-07-22,20220800,20220900,20220700
2022-08-22,20220900,20221000,20220800
2022-09-21,20221000,20221100,20220900
2022-10-21,20221100,20221200,20221000
2022-11-21,20221200,20230100,20221100
2022-12-22,20230100,20230200,20221200
2023-01-23,20230200,20230300,20230100
2023-02-20,20230300,20230400,20230200
2023-03-22,20230400,20230500,20230300
2023-04-21,20230500,20230600,20230400
2023-05-22,20230600,20230700,20230500
2023-06-21,20230700,20230800,20230600
2023-07-21,20230800,20230900,20230700
2023-08-22,20230900,20231000,20230800
2023-09-21,20231000,20231100,20230900
51 changes: 51 additions & 0 deletions data/futures/roll_calendars_csv/BTC*SPREAD2_BIDOFFER.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
DATE_TIME,current_contract,next_contract,carry_contract
2019-09-02,20190900,20191000,20190800
2019-09-20,20191000,20191100,20190900
2019-10-25,20191100,20191200,20191000
2019-11-29,20191200,20200100,20191100
2019-12-23,20200100,20200200,20191200
2020-01-22,20200200,20200300,20200100
2020-02-20,20200300,20200400,20200200
2020-03-23,20200400,20200500,20200300
2020-04-21,20200500,20200600,20200400
2020-05-22,20200600,20200700,20200500
2020-06-22,20200700,20200800,20200600
2020-07-22,20200800,20200900,20200700
2020-08-21,20200900,20201000,20200800
2020-09-21,20201000,20201100,20200900
2020-10-22,20201100,20201200,20201000
2020-11-20,20201200,20210100,20201100
2020-12-22,20210100,20210200,20201200
2021-01-22,20210200,20210300,20210100
2021-02-19,20210300,20210400,20210200
2021-03-22,20210400,20210500,20210300
2021-04-21,20210500,20210600,20210400
2021-05-21,20210600,20210700,20210500
2021-06-21,20210700,20210800,20210600
2021-07-22,20210800,20210900,20210700
2021-08-23,20210900,20211000,20210800
2021-09-21,20211000,20211100,20210900
2021-10-22,20211100,20211200,20211000
2021-11-22,20211200,20220100,20211100
2021-12-22,20220100,20220200,20211200
2022-01-21,20220200,20220300,20220100
2022-02-18,20220300,20220400,20220200
2022-03-22,20220400,20220500,20220300
2022-04-21,20220500,20220600,20220400
2022-05-23,20220600,20220700,20220500
2022-06-21,20220700,20220800,20220600
2022-07-22,20220800,20220900,20220700
2022-08-22,20220900,20221000,20220800
2022-09-21,20221000,20221100,20220900
2022-10-21,20221100,20221200,20221000
2022-11-21,20221200,20230100,20221100
2022-12-22,20230100,20230200,20221200
2023-01-23,20230200,20230300,20230100
2023-02-20,20230300,20230400,20230200
2023-03-22,20230400,20230500,20230300
2023-04-21,20230500,20230600,20230400
2023-05-22,20230600,20230700,20230500
2023-06-21,20230700,20230800,20230600
2023-07-21,20230800,20230900,20230700
2023-08-22,20230900,20231000,20230800
2023-09-21,20231000,20231100,20230900
51 changes: 51 additions & 0 deletions data/futures/roll_calendars_csv/BTC*SPREADBIDOFFER.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
DATE_TIME,current_contract,next_contract,carry_contract
2019-09-20 00:00:00,20190900,20191000,20190800
2019-09-27 00:00:00,20191000,20191100,20190900
2019-11-21 00:00:00,20191100,20191200,20191000
2019-12-20 00:00:00,20191200,20200100,20191100
2019-12-27 02:00:00,20200100,20200200,20191200
2020-01-31 00:00:00,20200200,20200300,20200100
2020-02-27 12:00:00,20200300,20200400,20200200
2020-03-27 00:00:00,20200400,20200500,20200300
2020-04-24 00:00:00,20200500,20200600,20200400
2020-05-29 00:00:00,20200600,20200700,20200500
2020-06-26 00:00:00,20200700,20200800,20200600
2020-07-31 00:00:00,20200800,20200900,20200700
2020-08-28 00:00:00,20200900,20201000,20200800
2020-09-25 00:00:00,20201000,20201100,20200900
2020-10-30 00:00:00,20201100,20201200,20201000
2020-11-27 00:00:00,20201200,20210100,20201100
2020-12-24 00:00:00,20210100,20210200,20201200
2021-01-29 00:00:00,20210200,20210300,20210100
2021-02-26 00:00:00,20210300,20210400,20210200
2021-03-26 00:00:00,20210400,20210500,20210300
2021-04-30 00:00:00,20210500,20210600,20210400
2021-05-28 00:00:00,20210600,20210700,20210500
2021-06-25 00:00:00,20210700,20210800,20210600
2021-07-30 00:00:00,20210800,20210900,20210700
2021-08-27 00:00:00,20210900,20211000,20210800
2021-09-24 00:00:00,20211000,20211100,20210900
2021-10-29 00:00:00,20211100,20211200,20211000
2021-11-26 00:00:00,20211200,20220100,20211100
2021-12-31 00:00:00,20220100,20220200,20211200
2022-01-28 00:00:00,20220200,20220300,20220100
2022-02-25 00:00:00,20220300,20220400,20220200
2022-03-25 00:00:00,20220400,20220500,20220300
2022-04-29 00:00:00,20220500,20220600,20220400
2022-05-27 00:00:00,20220600,20220700,20220500
2022-06-24 00:00:00,20220700,20220800,20220600
2022-07-29 00:00:00,20220800,20220900,20220700
2022-08-26 00:00:00,20220900,20221000,20220800
2022-09-30 00:00:00,20221000,20221100,20220900
2022-10-28 00:00:00,20221100,20221200,20221000
2022-11-25 00:00:00,20221200,20230100,20221100
2022-12-30 00:00:00,20230100,20230200,20221200
2023-01-27 00:00:00,20230200,20230300,20230100
2023-02-24 00:00:00,20230300,20230400,20230200
2023-03-31 00:00:00,20230400,20230500,20230300
2023-04-28 00:00:00,20230500,20230600,20230400
2023-05-26 06:00:00,20230600,20230700,20230500
2023-06-30 02:00:00,20230700,20230800,20230600
2023-07-28 01:00:00,20230800,20230900,20230700
2023-08-25 00:00:00,20230900,20231000,20230800
2023-09-29 00:00:00,20231000,20231100,20230900
28 changes: 28 additions & 0 deletions data/futures/roll_calendars_csv/ETH*SPREAD*BIDOFFER.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
DATE_TIME,current_contract,next_contract,carry_contract
2021-03-21 19:00:00,20210300,20210400,20210200
2021-03-26 08:00:00,20210400,20210500,20210300
2021-04-30 05:00:00,20210500,20210600,20210400
2021-05-28 00:00:00,20210600,20210700,20210500
2021-06-25 01:00:00,20210700,20210800,20210600
2021-07-30 00:00:00,20210800,20210900,20210700
2021-08-27 00:00:00,20210900,20211000,20210800
2021-09-24 00:00:00,20211000,20211100,20210900
2021-10-29 00:00:00,20211100,20211200,20211000
2021-11-26 01:00:00,20211200,20220100,20211100
2021-12-31 00:00:00,20220100,20220200,20211200
2022-01-28 00:00:00,20220200,20220300,20220100
2022-02-25 00:00:00,20220300,20220400,20220200
2022-03-25 00:00:00,20220400,20220500,20220300
2022-04-29 02:00:00,20220500,20220600,20220400
2022-05-27 00:00:00,20220600,20220700,20220500
2022-06-24 14:00:00,20220700,20220800,20220600
2022-07-29 00:00:00,20220800,20220900,20220700
2022-08-26 00:00:00,20220900,20221000,20220800
2022-09-30 00:00:00,20221000,20221100,20220900
2022-10-28 00:00:00,20221100,20221200,20221000
2022-11-25 13:00:00,20221200,20230100,20221100
2022-12-30 00:00:00,20230100,20230200,20221200
2023-01-27 14:00:00,20230200,20230300,20230100
2023-02-24 00:00:00,20230300,20230400,20230200
2023-03-31 12:00:00,20230400,20230500,20230300
2023-04-28 12:00:00,20230500,20230600,20230400
28 changes: 28 additions & 0 deletions data/futures/roll_calendars_csv/ETH*SPREAD.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
DATE_TIME,current_contract,next_contract,carry_contract
2021-03-21 19:00:00,20210300,20210400,20210200
2021-03-26 08:00:00,20210400,20210500,20210300
2021-04-30 05:00:00,20210500,20210600,20210400
2021-05-28 00:00:00,20210600,20210700,20210500
2021-06-25 01:00:00,20210700,20210800,20210600
2021-07-30 00:00:00,20210800,20210900,20210700
2021-08-27 00:00:00,20210900,20211000,20210800
2021-09-24 00:00:00,20211000,20211100,20210900
2021-10-29 00:00:00,20211100,20211200,20211000
2021-11-26 01:00:00,20211200,20220100,20211100
2021-12-31 00:00:00,20220100,20220200,20211200
2022-01-28 00:00:00,20220200,20220300,20220100
2022-02-25 00:00:00,20220300,20220400,20220200
2022-03-25 00:00:00,20220400,20220500,20220300
2022-04-29 02:00:00,20220500,20220600,20220400
2022-05-27 00:00:00,20220600,20220700,20220500
2022-06-24 14:00:00,20220700,20220800,20220600
2022-07-29 00:00:00,20220800,20220900,20220700
2022-08-26 00:00:00,20220900,20221000,20220800
2022-09-30 00:00:00,20221000,20221100,20220900
2022-10-28 00:00:00,20221100,20221200,20221000
2022-11-25 13:00:00,20221200,20230100,20221100
2022-12-30 00:00:00,20230100,20230200,20221200
2023-01-27 14:00:00,20230200,20230300,20230100
2023-02-24 00:00:00,20230300,20230400,20230200
2023-03-31 12:00:00,20230400,20230500,20230300
2023-04-28 12:00:00,20230500,20230600,20230400
28 changes: 28 additions & 0 deletions data/futures/roll_calendars_csv/ETH*SPREAD2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
DATE_TIME,current_contract,next_contract,carry_contract
2021-03-01,20210300,20210400,20210200
2021-03-22,20210400,20210500,20210300
2021-04-21,20210500,20210600,20210400
2021-05-21,20210600,20210700,20210500
2021-06-21,20210700,20210800,20210600
2021-07-22,20210800,20210900,20210700
2021-08-23,20210900,20211000,20210800
2021-09-21,20211000,20211100,20210900
2021-10-22,20211100,20211200,20211000
2021-11-22,20211200,20220100,20211100
2021-12-22,20220100,20220200,20211200
2022-01-21,20220200,20220300,20220100
2022-02-18,20220300,20220400,20220200
2022-03-22,20220400,20220500,20220300
2022-04-21,20220500,20220600,20220400
2022-05-23,20220600,20220700,20220500
2022-06-21,20220700,20220800,20220600
2022-07-22,20220800,20220900,20220700
2022-08-22,20220900,20221000,20220800
2022-09-21,20221000,20221100,20220900
2022-10-21,20221100,20221200,20221000
2022-11-21,20221200,20230100,20221100
2022-12-22,20230100,20230200,20221200
2023-01-23,20230200,20230300,20230100
2023-02-20,20230300,20230400,20230200
2023-03-22,20230400,20230500,20230300
2023-04-21,20230500,20230600,20230400
28 changes: 28 additions & 0 deletions data/futures/roll_calendars_csv/ETH*SPREAD2BIDOFFER.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
DATE_TIME,current_contract,next_contract,carry_contract
2021-03-01,20210300,20210400,20210200
2021-03-22,20210400,20210500,20210300
2021-04-21,20210500,20210600,20210400
2021-05-21,20210600,20210700,20210500
2021-06-21,20210700,20210800,20210600
2021-07-22,20210800,20210900,20210700
2021-08-23,20210900,20211000,20210800
2021-09-21,20211000,20211100,20210900
2021-10-22,20211100,20211200,20211000
2021-11-22,20211200,20220100,20211100
2021-12-22,20220100,20220200,20211200
2022-01-21,20220200,20220300,20220100
2022-02-18,20220300,20220400,20220200
2022-03-22,20220400,20220500,20220300
2022-04-21,20220500,20220600,20220400
2022-05-23,20220600,20220700,20220500
2022-06-21,20220700,20220800,20220600
2022-07-22,20220800,20220900,20220700
2022-08-22,20220900,20221000,20220800
2022-09-21,20221000,20221100,20220900
2022-10-21,20221100,20221200,20221000
2022-11-21,20221200,20230100,20221100
2022-12-22,20230100,20230200,20221200
2023-01-23,20230200,20230300,20230100
2023-02-20,20230300,20230400,20230200
2023-03-22,20230400,20230500,20230300
2023-04-21,20230500,20230600,20230400
1 change: 1 addition & 0 deletions sysbrokers/IB/client/ib_contracts_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@


class ibContractsClient(ibClient):

def broker_get_futures_contract_list(
self,
futures_instrument_with_ib_data: futuresInstrumentWithIBConfigData,
Expand Down
6 changes: 5 additions & 1 deletion sysbrokers/IB/client/ib_orders_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def broker_submit_order(
account_id: str = arg_not_supplied,
order_type: brokerOrderType = market_order_type,
limit_price: float = None,
what_if: bool = False
) -> tradeWithContract:
"""
Expand Down Expand Up @@ -121,7 +122,10 @@ def broker_submit_order(
limit_price=limit_price,
)

order_object = self.ib.placeOrder(ibcontract, ib_order)
if what_if:
order_object = self.ib.whatIfOrder(ibcontract, ib_order)
else:
order_object = self.ib.placeOrder(ibcontract, ib_order)

trade_with_contract = tradeWithContract(ibcontract_with_legs, order_object)

Expand Down
Loading

0 comments on commit cfab929

Please sign in to comment.