robcarver17 / pysystemtrade

Systematic Trading in python
GNU General Public License v3.0
2.57k stars 816 forks source link

Running manually, get no contract positions. #284

Closed rorymac closed 3 years ago

rorymac commented 3 years ago

I am running the system manually, I do not end up with contract positions.  Broker positions balance to Strategy position which balance to optimal positions.  What have I missed? 

Here is what I did: 

I started with a fresh DB, updated from csv files.  Manually ran update_system_backtests manually ran update_strategy_orders In interactive_order_stack  : 1 Create orders  : 10 Spawn contract orders from instrument orders Then  : 2 Fills and completions : 20 Manually fill broker or contract order  from [2] Contract Stack  fill in the details  then : 23 Pass fills upwards from contract to instrument order  did that for each order Then : 24 Handle completed orders  then ran the end of day : 4 Delete and Clean  : 42 End of day process.  

A balance trade does not work as the instruments have no contract data. 

Here is the output :  from Interactive_order_stack : 0 View : 9 View positions

Optimal vs actual
                  current        optimal  breaks
live_300 BOBL         4.0    3.603/4.403   False
live_300 CAC          0.0    0.231/0.282   False
live_300 COPPER       0.0    0.000/0.000   False
live_300 CORN         3.0    3.474/4.246   False
live_300 CRUDE_W      0.0    0.000/0.000   False
live_300 EDOLLAR     13.0  12.652/15.464   False
live_300 EUROSTX      0.0    0.345/0.422   False
live_300 GAS_US      -2.0  -2.105/-1.722   False
live_300 GBP          2.0    2.249/2.749   False
live_300 LEANHOG      0.0    0.337/0.412   False
live_300 MXP          0.0    0.483/0.590   False
live_300 PLAT         0.0    0.000/0.000   False
live_300 US2         38.0  37.578/45.928   False
live_300 V2X         -2.0  -2.984/-2.441   False
live_300 VIX          1.0    0.706/0.863   False
Strategy positions
  strategy_name instrument_code  position
0      live_300            BOBL       4.0
1      live_300            CORN       3.0
2      live_300         EDOLLAR      13.0
3      live_300          GAS_US      -2.0
4      live_300             GBP       2.0
5      live_300             US2      38.0
6      live_300             V2X      -2.0
7      live_300             VIX       1.0

Contract level positions
Empty DataFrame
Columns: [instrument_code, contract_date, expiry_date, position]
Index: []

BREAKS between strategy and contract positions: [EDOLLAR, GBP, GAS_US, VIX, CORN, V2X, BOBL, US2]

Broker positions
  instrument_code contract_date          expiry_date  position
7            BOBL      20210308  2021-03-08 00:00:00       4.0
2            CORN      20211214  2021-12-14 00:00:00       3.0
4         EDOLLAR      20240318  2024-03-18 00:00:00      13.0
0          GAS_US      20210329  2021-03-29 00:00:00      -2.0
1             GBP      20210315  2021-03-15 00:00:00       2.0
5             US2      20210331  2021-03-31 00:00:00      38.0
3             V2X      20210421  2021-04-21 00:00:00      -2.0
6             VIX      20210421  2021-04-21 00:00:00       1.0

BREAKS between broker and DB stored contract positions: [GAS_US/20210329, GBP/20210315, CORN/20211214, V2X/20210421, EDOLLAR/20240318, US2/20210331, VIX/20210421, BOBL/20210308]
robcarver17 commented 3 years ago

Can I just say first this is very helpful, because I never actually ran the system from a 'cold start' (I backfilled the data from my old system) so it's a great test.

The bad news is I couldn't replicate the problem. I've pasted below the steps I took and added some comments.

If you can do a similar thing, inspecting the stacks and positions after each step, we might be able to work out what's going on.

#Manual position delete in python command line
from sysproduction.data.positions import diagPositions
d = diagPositions()
d.data.db_contract_position.mongo_data._mongo.collection.drop()
d.data.db_strategy_position.mongo_data._mongo.collection.drop()

# back in the shell
rob@boromir:~/pysystemtrade/sysproduction/linux/scripts$ . update_strategy_orders 
....
rob@boromir:~/pysystemtrade/sysproduction/linux/scripts$ . interactive_order_stack 

sysproduction.interactive_order_stack.interactive_order_stack:
None

Arguments:
[]

0: View
1: Create orders
2: Fills and completions
3: Netting, cancellation and locks
4: Delete and clean

Your choice? <RETURN for EXIT> 0
0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions

Your choice? <RETURN for Back> 1

INSTRUMENT STACK 

(Order ID:30718) Type best for medium_speed_TF_carry AUD, qty [1], fill [0]@ price, None Parent:no parent Children:no_children

.... removed a dozen other orders...

(Order ID:30731) Type best for medium_speed_TF_carry WHEAT, qty [1], fill [0]@ price, None Parent:no parent Children:no_children
0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions

Your choice? <RETURN for Back> 9
2021-02-02:1040.32 {'type': '', 'component': 'mongoIbBrokerClientIdData'}  Locked IB client ID 356
Optimal vs actual
                               current        optimal  breaks
medium_speed_TF_carry AEX            0   -0.041/0.041   False
medium_speed_TF_carry PALLAD         0   -0.020/0.020   False

.. removed lots here...

medium_speed_TF_carry AUD            0    0.684/0.947    True
medium_speed_TF_carry OAT            0    1.083/1.345    True
medium_speed_TF_carry WHEAT          0    0.860/1.117    True
Strategy positions
Empty DataFrame
Columns: [strategy_name, instrument_code, position]
Index: []

 Contract level positions
Empty DataFrame
Columns: [instrument_code, contract_date, expiry_date, position]
Index: []
(No breaks positions consistent)

 Broker positions
Empty DataFrame
Columns: [instrument_code, contract_date, expiry_date, position]
Index: []
(No breaks positions consistent)
0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions

Your choice? <RETURN for Back> 
0: View
1: Create orders
2: Fills and completions
3: Netting, cancellation and locks
4: Delete and clean

Your choice? <RETURN for EXIT> 1
10: Spawn contract orders from instrument orders
11: Create force roll contract orders
12: Create (and try to execute...) IB broker orders
13: Balance trade: Create a series of trades and immediately fill them (not actually executed)
14: Balance instrument trade: Create a trade just at the strategy level and fill (not actually executed)
15: Manual trade: Create a series of trades to be executed
16: Cash FX trade

Your choice? <RETURN for Back> 10
This will create contract orders for any instrument orders that don't have them
Instrument orders:

INSTRUMENT STACK 

(Order ID:30718) Type best for medium_speed_TF_carry AUD, qty [1], fill [0]@ price, None Parent:no parent Children:no_children
.... snip...
(Order ID:30731) Type best for medium_speed_TF_carry WHEAT, qty [1], fill [0]@ price, None Parent:no parent Children:no_children

Which instrument order ID <RETURN for All> 
Are you sure? (Y/other)Y
Library created, but couldn't enable sharding: no such command: 'enablesharding', bad cmd: '{ enablesharding: "arctic_production", lsid: { id: UUID("fbd85057-e8c6-4864-b3b0-bf7e730ea66a") }, $db: "admin", $readPreference: { mode: "primaryPreferred" } }'. This is OK if you're not 'admin'
Library created, but couldn't enable sharding: no such command: 'enablesharding', bad cmd: '{ enablesharding: "arctic_production", lsid: { id: UUID("a9d80891-e5e5-476c-9a3b-94a4a2c07d34") }, $db: "admin", $readPreference: { mode: "primaryPreferred" } }'. This is OK if you're not 'admin'
2021-02-02:1041.08 {'type': '', 'broker': 'IB', 'clientid': 356, 'strategy_name': 'medium_speed_TF_carry', 'instrument_code': 'AUD', 'instrument_order_id': 30718}  No roll, allocating entire order (Order ID:30718) Type best for medium_speed_TF_carry AUD, qty [1], fill [0]@ price, None Parent:no parent Children:no_children to current contract 20210300
2021-02-02:1041.11 {'type': '', 'broker': 'IB', 'clientid': 356, 'strategy_name': 'medium_speed_TF_carry', 'instrument_code': 'AUD', 'contract_order_id': '', 'instrument_order_id': 30718}  'Best' order so allocating to original_best
2021-02-02:1041.14 {'type': '', 'broker': 'IB', 'clientid': 356, 'strategy_name': 'medium_speed_TF_carry', 'instrument_code': 'AUD', 'instrument_order_id': 30718}  List of contract orders spawned [(Order ID:no order ID) Type best for medium_speed_TF_carry/AUD/20210300, qty [1], fill [0]@ price, None Parent:30718 Children:no_children]
2021-02-02:1041.16 {'type': '', 'broker': 'IB', 'clientid': 356, 'strategy_name': 'medium_speed_TF_carry', 'instrument_code': 'AUD', 'instrument_order_id': 30718, 'contract_order_id': ''}  Put child order (Order ID:no order ID) Type best for medium_speed_TF_carry/AUD/20210300, qty [1], fill [0]@ price, None Parent:30718 Children:no_children LOCKED on stack with ID 30787 from parent order (Order ID:30718) Type best for medium_speed_TF_carry AUD, qty [1], fill [0]@ price, None Parent:no parent Children:no_children
Library created, but couldn't enable sharding: no such command: 'enablesharding', bad cmd: '{ enablesharding: "arctic_production", lsid: { id: UUID("a323bfab-1ce9-4625-af93-b1c99e4a3298") }, $db: "admin", $readPreference: { mode: "primaryPreferred" } }'. This is OK if you're not 'admin'
Library created, but couldn't enable sharding: no such command: 'enablesharding', bad cmd: '{ enablesharding: "arctic_production", lsid: { id: UUID("1f6369d1-f43e-43e4-8f57-9596847637de") }, $db: "admin", $readPreference: { mode: "primaryPreferred" } }'. This is OK if you're not 'admin'

... snip...

If you are trading manually, you should now view the contract order stack and trade.
Then create manual fills for contract orders

Your choice? <RETURN for Back> 
0: View
1: Create orders
2: Fills and completions
3: Netting, cancellation and locks
4: Delete and clean

Your choice? <RETURN for EXIT> 0
0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions

Your choice? <RETURN for Back> 2

CONTRACT STACK 

(Order ID:30787) Type best for medium_speed_TF_carry/AUD/20210300, qty [1], fill [0]@ price, None Parent:30718 Children:no_children

... snip...

(Order ID:30799) Type best for medium_speed_TF_carry/WHEAT/20211200, qty [1], fill [0]@ price, None Parent:30731 Children:no_children
0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions

Your choice? <RETURN for Back> 1

INSTRUMENT STACK 

(Order ID:30718) Type best for medium_speed_TF_carry AUD, qty [1], fill [0]@ price, None Parent:no parent Children:[30787]
... snip
(Order ID:30731) Type best for medium_speed_TF_carry WHEAT, qty [1], fill [0]@ price, None Parent:no parent Children:[30799]

Your choice? <RETURN for Back> 
0: View
1: Create orders
2: Fills and completions
3: Netting, cancellation and locks
4: Delete and clean

Your choice? <RETURN for EXIT> 2
20: Manually fill broker or contract order
21: Get broker fills from IB
22: Pass fills upwards from broker to contract order
23: Pass fills upwards from contract to instrument order
24: Handle completed orders

Your choice? <RETURN for Back> 20
Broker stack [1], or Contract stack [2]? <RETURN for Exit> 2
(Order ID:30787) Type best for medium_speed_TF_carry/AUD/20210300, qty [1], fill [0]@ price, None Parent:30718 Children:no_children
... snip....
Enter order ID <RETURN for Cancel> 30787
Order now (Order ID:30787) Type best for medium_speed_TF_carry/AUD/20210300, qty [1], fill [0]@ price, None Parent:30718 Children:no_children
Quantity to fill (must be less than or equal to [1]) <RETURN for default [1]> 
Filled price 100
Fill datetime: Enter date and time in format %Y%-%m-%d eg '2020-05-30' OR '%Y-%m-%d %H:%M:%S' eg '2020-05-30 14:04:11' <RETURN for now>
2021-02-02:1045.03 {'type': '', 'component': 'mongoContractOrderStackData', 'strategy_name': 'medium_speed_TF_carry', 'instrument_code': 'AUD', 'contract_order_id': 30787, 'instrument_order_id': 30718}  Changed fill qty from [0] to [1] for order (Order ID:30787) Type best for medium_speed_TF_carry/AUD/20210300, qty [1], fill [0]@ price, None Parent:30718 Children:no_children

### NOTE: THE POSITIONS ARE UPDATED AT THIS POINT SO SHOULD MATCH

2021-02-02:1045.06 {'type': ''}  Updated position of AUD/20210300 from 0 to 1; new position in db is 1
2021-02-02:1045.08 {'type': ''}  Updated position of AUD/20210300 because of trade (Order ID:30787) Type best for medium_speed_TF_carry/AUD/20210300, qty [1], fill [0]@ price, None Parent:30718 Children:no_children ID:30787 with fills [1]

# THE FILL IS PASSED UP TO THE INSTRUMENT ORDER HERE

2021-02-02:1045.10 {'type': ''}  Updated position of medium_speed_TF_carry/AUD from 0 to 1 because of trade (Order ID:30718) Type best for medium_speed_TF_carry AUD, qty [1], fill [0]@ price, None Parent:no parent Children:[30787] 30718

2021-02-02:1045.12 {'type': '', 'component': 'mongoInstrumentOrderStackData', 'strategy_name': 'medium_speed_TF_carry', 
'instrument_code': 'AUD', 'instrument_order_id': 30718}  Changed fill qty from [0] to [1] for order (Order ID:30718) Type best for medium_speed_TF_carry AUD, qty [1], fill [0]@ price, None Parent:no parent Children:[30787]
Order now (Order ID:30787) Type best for medium_speed_TF_carry/AUD/20210300, qty [1], fill [1]@ price, 100.0 Parent:30718 Children:no_children INACTIVE

## ORDERS ARE NOW COMPLETED AND SHOULD HAVE GONE

If stack process not running, your next job will be to pass fills upwards
20: Manually fill broker or contract order
21: Get broker fills from IB
22: Pass fills upwards from broker to contract order
23: Pass fills upwards from contract to instrument order
24: Handle completed orders

Your choice? <RETURN for Back> 
0: View
1: Create orders
2: Fills and completions
3: Netting, cancellation and locks
4: Delete and clean

Your choice? <RETURN for EXIT> 0
0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions

Your choice? <RETURN for Back> 9
Optimal vs actual
                               current        optimal  breaks
medium_speed_TF_carry AEX            0   -0.041/0.041   False
.....

### POSITIONS ARE CORRECT HERE:
Strategy positions
           strategy_name instrument_code  position
0  medium_speed_TF_carry             AUD         1

 Contract level positions
  instrument_code contract_date          expiry_date  position
0             AUD      20210315  2021-03-15 00:00:00       1.0
(No breaks positions consistent)

## RUNNING ON A TEST ACCOUNT SO THIS IS TO EXPECTED
 Broker positions
Empty DataFrame
Columns: [instrument_code, contract_date, expiry_date, position]
Index: []

BREAKS between broker and DB stored contract positions: [AUD/20210315]

0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions

Your choice? <RETURN for Back> 
0: View
1: Create orders
2: Fills and completions
3: Netting, cancellation and locks
4: Delete and clean

Your choice? <RETURN for EXIT> 2
20: Manually fill broker or contract order
21: Get broker fills from IB
22: Pass fills upwards from broker to contract order
23: Pass fills upwards from contract to instrument order
24: Handle completed orders

Your choice? <RETURN for Back> 23
This will process any fills applied to contract orders and pass them up to instrument orders

CONTRACT STACK 
### THE CONTRACT ORDER FOR AUD HAS GONE:
(Order ID:30788) Type best for medium_speed_TF_carry/CAC/20210200, qty [1], fill [0]@ price, None Parent:30719 Children:no_children
.....
Which order ID? <RETURN for for all> 
Are you sure? (Y/other)Y
If stack process not running, your next job will be to handle completed orders
20: Manually fill broker or contract order
21: Get broker fills from IB
22: Pass fills upwards from broker to contract order
23: Pass fills upwards from contract to instrument order
24: Handle completed orders

Your choice? <RETURN for Back> 24
This will process any completed orders (all fills present)

INSTRUMENT STACK 
### THE INSTRUMENT ORDER FOR AUD HAS GONE:
(Order ID:30719) Type best for medium_speed_TF_carry CAC, qty [1], fill [0]@ price, None Parent:no parent Children:[30788]
Which instrument order ID? <RETURN for All> 
Are you sure? (Y/other)Y
20: Manually fill broker or contract order
21: Get broker fills from IB
22: Pass fills upwards from broker to contract order
23: Pass fills upwards from contract to instrument order
24: Handle completed orders

Your choice? <RETURN for Back> 
0: View
1: Create orders
2: Fills and completions
3: Netting, cancellation and locks
4: Delete and clean

Your choice? <RETURN for EXIT> 0
0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions

Your choice? <RETURN for Back> 9
Optimal vs actual
## position now optimal
                               current        optimal  breaks
medium_speed_TF_carry AUD            1    0.684/0.947   False
Strategy positions
           strategy_name instrument_code  position
0  medium_speed_TF_carry             AUD         1

 Contract level positions
  instrument_code contract_date          expiry_date  position
0             AUD      20210315  2021-03-15 00:00:00       1.0
(No breaks positions consistent)

 Broker positions
Empty DataFrame
Columns: [instrument_code, contract_date, expiry_date, position]
Index: []

BREAKS between broker and DB stored contract positions: [AUD/20210315]

0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions

Your choice? <RETURN for Back> 
0: View
1: Create orders
2: Fills and completions
3: Netting, cancellation and locks
4: Delete and clean

Your choice? <RETURN for EXIT> 4
40: Delete entire stack (CAREFUL!)
41: Delete specific order ID (CAREFUL!)
42: End of day process (cancel orders, mark all orders as complete, delete orders)

## RUNNING END OF DAY IN CASE IT DOES SOMETHING WEIRD

Your choice? <RETURN for Back> 42
Will cancel all broker orders, get outstanding fills, mark all orders as complete, update positions, remove everything from stack
Are you sure? (Y/other)Y
2021-02-02:1046.31 {'type': '', 'broker': 'IB', 'clientid': 356}  Running safe stack removal
2021-02-02:1046.34 {'type': '', 'broker': 'IB', 'clientid': 356}  Trying to cancel all broker orders
2021-02-02:1046.36 {'type': '', 'broker': 'IB', 'clientid': 356}  All orders cancelled okay
2021-02-02:1046.38 {'type': '', 'broker': 'IB', 'clientid': 356}  Processing fills
2021-02-02:1046.41 {'type': '', 'broker': 'IB', 'clientid': 356}  Processing completions
40: Delete entire stack (CAREFUL!)
41: Delete specific order ID (CAREFUL!)
42: End of day process (cancel orders, mark all orders as complete, delete orders)

Your choice? <RETURN for Back>     
0: View
1: Create orders
2: Fills and completions
3: Netting, cancellation and locks
4: Delete and clean

Your choice? <RETURN for EXIT> 0
0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions

Your choice? <RETURN for Back> 9
Optimal vs actual
medium_speed_TF_carry AUD            1    0.684/0.947   False
Strategy positions
           strategy_name instrument_code  position
0  medium_speed_TF_carry             AUD         1

 Contract level positions
  instrument_code contract_date          expiry_date  position
0             AUD      20210315  2021-03-15 00:00:00       1.0
(No breaks positions consistent)

 Broker positions
Empty DataFrame
Columns: [instrument_code, contract_date, expiry_date, position]
Index: []

BREAKS between broker and DB stored contract positions: [AUD/20210315]

0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions

Your choice? <RETURN for Back> 1

# DOUBLE CHECK STACKS ARE EMPTY

INSTRUMENT STACK 

0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions
rorymac commented 3 years ago

Rob TLDR : following along your method, the problem comes in after filling in the orders manually, they do not appear in the contract level positions as in your example. This is before passing them upwards.

Here you go:

After running update_strategy_orders

Arguments:
[]

0: View
1: Create orders
2: Fills and completions
3: Netting, cancellation and locks
4: Delete and clean

Your choice? <RETURN for EXIT> 0
0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions

Your choice? <RETURN for Back> 1

INSTRUMENT STACK 

(Order ID:2) For live_300/BOBL, qty [3.0] fill [0],  Parent:no parent Child:no_children  
(Order ID:3) For live_300/CAC, qty [1.0] fill [0],  Parent:no parent Child:no_children  
(Order ID:4) For live_300/CORN, qty [4.0] fill [0],  Parent:no parent Child:no_children  
(Order ID:5) For live_300/EDOLLAR, qty [12.0] fill [0],  Parent:no parent Child:no_children  
(Order ID:6) For live_300/EUROSTX, qty [2.0] fill [0],  Parent:no parent Child:no_children  
(Order ID:7) For live_300/GAS_US, qty [-1.0] fill [0],  Parent:no parent Child:no_children  
(Order ID:8) For live_300/GBP, qty [2.0] fill [0],  Parent:no parent Child:no_children  
(Order ID:9) For live_300/LEANHOG, qty [-1.0] fill [0],  Parent:no parent Child:no_children  
(Order ID:10) For live_300/MXP, qty [1.0] fill [0],  Parent:no parent Child:no_children  
(Order ID:11) For live_300/US2, qty [38.0] fill [0],  Parent:no parent Child:no_children  
(Order ID:12) For live_300/V2X, qty [1.0] fill [0],  Parent:no parent Child:no_children  
(Order ID:13) For live_300/VIX, qty [1.0] fill [0],  Parent:no parent Child:no_children 

<MENU interactive order stack>  

Your choice? <RETURN for Back> 2

CONTRACT STACK 

2021-02-02:1138.59 {'type': '', 'component': 'mongoIbBrokerClientIdData'}  Locked IB client ID 4

<MENU interactive order stack>  

Your choice? <RETURN for Back> 3

Broker stack (from database): 

<MENU interactive order stack>

Your choice? <RETURN for Back> 9
2021-02-02:1110.24 {'type': '', 'component': 'mongoIbBrokerClientIdData'}  Locked IB client ID 4
Optimal vs actual
                  current        optimal  breaks
live_300 COPPER         0    0.000/0.000   False
live_300 CRUDE_W        0    0.000/0.000   False
live_300 PLAT           0    0.000/0.000   False
live_300 BOBL           0    2.821/3.448    True
live_300 CAC            0    0.934/1.141    True
live_300 CORN           0    3.793/4.636    True
live_300 EDOLLAR        0  11.670/14.263    True
live_300 EUROSTX        0    2.010/2.457    True
live_300 GAS_US         0  -0.974/-0.797    True
live_300 GBP            0    1.846/2.256    True
live_300 LEANHOG        0  -0.699/-0.572    True
live_300 MXP            0    0.893/1.092    True
live_300 US2            0  37.814/46.218    True
live_300 V2X            0    0.727/0.889    True
live_300 VIX            0    0.767/0.938    True
Strategy positions
Empty DataFrame
Columns: [strategy_name, instrument_code, position]
Index: []

 Contract level positions
Empty DataFrame
Columns: [instrument_code, contract_date, expiry_date, position]
Index: []
(No breaks positions consistent)

 Broker positions
   instrument_code contract_date          expiry_date  position
9             BOBL      20210308  2021-03-08 00:00:00       4.0
2              CAC      20210219  2021-02-19 00:00:00       1.0
3             CORN      20211214  2021-12-14 00:00:00       4.0
7          EDOLLAR      20240318  2024-03-18 00:00:00      13.0
4          EUROSTX      20210319  2021-03-19 00:00:00       2.0
0           GAS_US      20210329  2021-03-29 00:00:00      -1.0
1              GBP      20210315  2021-03-15 00:00:00       2.0
11         LEANHOG      20210415  2021-04-15 00:00:00      -1.0
10             MXP      20210315  2021-03-15 00:00:00       1.0
6              US2      20210331  2021-03-31 00:00:00      39.0
5              V2X      20210421  2021-04-21 00:00:00      -2.0
8              VIX      20210421  2021-04-21 00:00:00       1.0

BREAKS between broker and DB stored contract positions: [GAS_US/20210329, GBP/20210315, CAC/20210219, CORN/20211214, EUROSTX/20210319, V2X/20210421, US2/20210331, EDOLLAR/20240318, VIX/20210421, BOBL/20210308, MXP/20210315, LEANHOG/20210415]

Ok here it gets interesting as I have positions from yesterday and have traded the days new orders at the broker. Hence the breaks !
Also there will be a difference in the positions generated here as the data update was done earlier (CST 15:40) on the "working server" (CST 02:30) 

so for the purposes of the exercise I will put in all the positions as todays orders at the holding value. 
BUT first to spawn the contract orders from instrument orders.

Your choice? <RETURN for EXIT> 1
10: Spawn contract orders from instrument orders
11: Create force roll contract orders
12: Create (and try to execute...) IB broker orders
13: Balance trade: Create a series of trades and immediately fill them (not actually executed)
14: Balance instrument trade: Create a trade just at the strategy level and fill (not actually executed)
15: Manual trade: Create a series of trades to be executed
16: Cash FX trade

Your choice? <RETURN for Back> 10
This will create contract orders for any instrument orders that don't have them
Instrument orders:

INSTRUMENT STACK 

(Order ID:2) For live_300/BOBL, qty [3.0] fill [0],  Parent:no parent Child:no_children  
(Order ID:3) For live_300/CAC, qty [1.0] fill [0],  Parent:no parent Child:no_children  
..snip..
(Order ID:13) For live_300/VIX, qty [1.0] fill [0],  Parent:no parent Child:no_children  

Which instrument order ID <RETURN for All>  
Are you sure? (Y/other)Y
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
2021-02-02:1145.09 {'type': '', 'broker': 'IB', 'clientid': 4, 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': 2}  No roll, allocating entire order (Order ID:2) For live_300/BOBL, qty [3.0] fill [0],  Parent:no parent Child:no_children   {'order_type': 'best', 'limit_contract': None, 'limit_price': None, 'reference_contract': '20210300', 'reference_price': 135.18, 'manual_trade': False, 'roll_order': False, 'reference_datetime': datetime.datetime(2021, 2, 2, 11, 37, 2, 662000), 'generated_datetime': datetime.datetime(2021, 2, 2, 11, 38, 2, 81000)} to current contract 20210300
...snip ...
2021-02-02:1145.19 {'type': '', 'broker': 'IB', 'clientid': 4, 'strategy_name': 'live_300', 'instrument_code': 'VIX', 'instrument_order_id': 13, 'contract_order_id': ''}  Put child order (Order ID:no order ID) For live_300/VIX/20210400, qty [1.0] fill [0],  Parent:13 Child:no_children LOCKED  {'algo_to_use': 'sysexecution.algos.algo_original_best.algoOriginalBest', 'reference_price': 31.1, 'limit_price': None, 'manual_trade': False, 'manual_fill': False, 'roll_order': False, 'calendar_spread_order': False, 'inter_spread_order': False, 'generated_datetime': datetime.datetime(2021, 2, 2, 11, 45, 18, 621945), 'reference_of_controlling_algo': None, 'split_order': False, 'sibling_id_for_split_order': None} on stack with ID 13 from parent order (Order ID:13) For live_300/VIX, qty [1.0] fill [0],  Parent:no parent Child:no_children   {'order_type': 'best', 'limit_contract': None, 'limit_price': None, 'reference_contract': '20210400', 'reference_price': 31.1, 'manual_trade': False, 'roll_order': False, 'reference_datetime': datetime.datetime(2021, 2, 2, 11, 37, 13, 616000), 'generated_datetime': datetime.datetime(2021, 2, 2, 11, 38, 2, 829000)}
If you are trading manually, you should now view the contract order stack and trade.
Then create manual fills for contract orders

Your choice? <RETURN for Back> 2

CONTRACT STACK 

GBM:(Order ID:2) For live_300/BOBL/20210300, qty [3.0] fill [0],  Parent:2 Child:no_children  
CAC40:(Order ID:3) For live_300/CAC/20210200, qty [1.0] fill [0],  Parent:3 Child:no_children Your choice? <RETURN for Back> 2
... snip...
VIX:(Order ID:13) For live_300/VIX/20210400, qty [1.0] fill [0],  Parent:13 Child:no_children  

Your choice? <RETURN for Back> 1

INSTRUMENT STACK 

(Order ID:2) For live_300/BOBL, qty [3.0] fill [0],  Parent:no parent Child:[2]  
(Order ID:3) For live_300/CAC, qty [1.0] fill [0],  Parent:no parent Child:[3]  
... snip...
(Order ID:13) For live_300/VIX, qty [1.0] fill [0],  Parent:no parent Child:[13]

If stack process not running, your next job will be to pass fills upwards
20: Manually fill broker or contract order
21: Get broker fills from IB
22: Pass fills upwards from broker to contract order
23: Pass fills upwards from contract to instrument order
24: Handle completed orders

Your choice? <RETURN for Back> 20
Broker stack [1], or Contract stack [2]? <RETURN for Exit> 2
(Order ID:2) For live_300/BOBL/20210300, qty [3.0] fill [3.0],  Parent:2 Child:no_children  
(Order ID:3) For live_300/CAC/20210200, qty [1.0] fill [1.0],  Parent:3 Child:no_children  
(Order ID:4) For live_300/CORN/20211200, qty [4.0] fill [4.0],  Parent:4 Child:no_children  
(Order ID:5) For live_300/EDOLLAR/20240300, qty [12.0] fill [12.0],  Parent:5 Child:no_children  
(Order ID:6) For live_300/EUROSTX/20210300, qty [2.0] fill [2.0],  Parent:6 Child:no_children  
(Order ID:7) For live_300/GAS_US/20210400, qty [-1.0] fill [-1.0],  Parent:7 Child:no_children  
(Order ID:8) For live_300/GBP/20210300, qty [2.0] fill [2.0],  Parent:8 Child:no_children  
(Order ID:9) For live_300/LEANHOG/20210400, qty [-1.0] fill [-1.0],  Parent:9 Child:no_children  
(Order ID:10) For live_300/MXP/20210300, qty [1.0] fill [1.0],  Parent:10 Child:no_children  
(Order ID:11) For live_300/US2/20210300, qty [38.0] fill [38.0],  Parent:11 Child:no_children  
(Order ID:12) For live_300/V2X/20210400, qty [1.0] fill [1.0],  Parent:12 Child:no_children  
(Order ID:13) For live_300/VIX/20210400, qty [1.0] fill [0],  Parent:13 Child:no_children

with one to go: 

Enter order ID <RETURN for Cancel> 13
Order now (Order ID:13) For live_300/VIX/20210400, qty [1.0] fill [0],  Parent:13 Child:no_children   {'algo_to_use': 'sysexecution.algos.algo_original_best.algoOriginalBest', 'reference_price': 31.1, 'limit_price': None, 'manual_trade': False, 'manual_fill': False, 'roll_order': False, 'calendar_spread_order': False, 'inter_spread_order': False, 'generated_datetime': datetime.datetime(2021, 2, 2, 11, 45, 18, 621000), 'reference_of_controlling_algo': None, 'split_order': False, 'sibling_id_for_split_order': None}
Quantity to fill (must be less than or equal to [1.0]) <RETURN for default [1.0]> 
Filled price 31.3
Fill datetime: Enter date and time in format %Y%-%m-%d eg '2020-05-30' OR '%Y-%m-%d %H:%M:%S' eg '2020-05-30 14:04:11' <RETURN for now>
2021-02-02:1217.21 {'type': '', 'broker': 'IB', 'clientid': 4, 'component': 'mongoContractOrderStackData', 'strategy_name': 'live_300', 'instrument_code': 'VIX', 'instrument_order_id': 13}  Changed fill qty from [0] to [1.0] for order (Order ID:13) For live_300/VIX/20210400, qty [1.0] fill [0],  Parent:13 Child:no_children   {'algo_to_use': 'sysexecution.algos.algo_original_best.algoOriginalBest', 'reference_price': 31.1, 'limit_price': None, 'manual_trade': False, 'manual_fill': False, 'roll_order': False, 'calendar_spread_order': False, 'inter_spread_order': False, 'generated_datetime': datetime.datetime(2021, 2, 2, 11, 45, 18, 621000), 'reference_of_controlling_algo': None, 'split_order': False, 'sibling_id_for_split_order': None}
Order now (Order ID:13) For live_300/VIX/20210400, qty [1.0] fill [1.0],  Parent:13 Child:no_children  Fill [31.3] on 2021-02-02 12:17:21.430000 {'algo_to_use': 'sysexecution.algos.algo_original_best.algoOriginalBest', 'reference_price': 31.1, 'limit_price': None, 'manual_trade': False, 'manual_fill': True, 'roll_order': False, 'calendar_spread_order': False, 'inter_spread_order': False, 'generated_datetime': datetime.datetime(2021, 2, 2, 11, 45, 18, 621000), 'reference_of_controlling_algo': None, 'split_order': False, 'sibling_id_for_split_order': None}

Last one done. 

 this is where we diverge. 

Your choice? <RETURN for EXIT> 0
0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions

Your choice? <RETURN for Back> 9
Optimal vs actual
                  current        optimal  breaks
live_300 COPPER         0    0.000/0.000   False
live_300 CRUDE_W        0    0.000/0.000   False
live_300 PLAT           0    0.000/0.000   False
live_300 BOBL           0    2.820/3.447    True
live_300 CAC            0    0.933/1.141    True
live_300 CORN           0    3.792/4.634    True
live_300 EDOLLAR        0  11.665/14.258    True
live_300 EUROSTX        0    2.009/2.456    True
live_300 GAS_US         0  -0.973/-0.796    True
live_300 GBP            0    1.845/2.255    True
live_300 LEANHOG        0  -0.698/-0.571    True
live_300 MXP            0    0.893/1.091    True
live_300 US2            0  37.799/46.199    True
live_300 V2X            0    0.727/0.888    True
live_300 VIX            0    0.767/0.937    True
Strategy positions
Empty DataFrame
Columns: [strategy_name, instrument_code, position]
Index: []

 Contract level positions
Empty DataFrame
Columns: [instrument_code, contract_date, expiry_date, position]
Index: []
(No breaks positions consistent)

 Broker positions
   instrument_code contract_date          expiry_date  position
9             BOBL      20210308  2021-03-08 00:00:00       4.0
2              CAC      20210219  2021-02-19 00:00:00       1.0
3             CORN      20211214  2021-12-14 00:00:00       4.0
7          EDOLLAR      20240318  2024-03-18 00:00:00      13.0
4          EUROSTX      20210319  2021-03-19 00:00:00       2.0
0           GAS_US      20210329  2021-03-29 00:00:00      -1.0
1              GBP      20210315  2021-03-15 00:00:00       2.0
11         LEANHOG      20210415  2021-04-15 00:00:00      -1.0
10             MXP      20210315  2021-03-15 00:00:00       1.0
6              US2      20210331  2021-03-31 00:00:00      39.0
5              V2X      20210421  2021-04-21 00:00:00      -2.0
8              VIX      20210421  2021-04-21 00:00:00       1.0

BREAKS between broker and DB stored contract positions: [GAS_US/20210329, GBP/20210315, CAC/20210219, CORN/20211214, EUROSTX/20210319, V2X/20210421, US2/20210331, EDOLLAR/20240318, VIX/20210421, BOBL/20210308, MXP/20210315, LEANHOG/20210415]

There are no contract positions after entering the orders manually 
rorymac commented 3 years ago

However the collection " CONTRACT_ORDER_STACK" in production db has data and has the fills :

for BOBL:

/* 2 */
{
    "_id" : ObjectId("60198fa5a82795e099998212"),
    "key" : "live_300/BOBL/20210300",
    "trade" : [ 
        3.0
    ],
    "fill" : [ 
        3.0
    ],
    "fill_datetime" : ISODate("2021-02-02T12:11:41.562Z"),
    "filled_price" : [ 
        135.21
    ],
    "locked" : false,
    "order_id" : 2,
    "modification_status" : null,
    "modification_quantity" : null,
    "parent" : 2,
    "children" : "",
    "active" : true,
    "algo_to_use" : "sysexecution.algos.algo_original_best.algoOriginalBest",
    "reference_price" : 135.18,
    "limit_price" : null,
    "manual_trade" : false,
    "manual_fill" : true,
    "roll_order" : false,
    "calendar_spread_order" : false,
    "inter_spread_order" : false,
    "generated_datetime" : ISODate("2021-02-02T11:45:09.246Z"),
    "reference_of_controlling_algo" : null,
    "split_order" : false,
    "sibling_id_for_split_order" : null
}
robcarver17 commented 3 years ago

Sorry but you omitted the stack trace at a crucial moment, what gets logged immediately after the manual fill:


Your choice? <RETURN for Back> 20
Broker stack [1], or Contract stack [2]? <RETURN for Exit> 2
(Order ID:30787) Type best for medium_speed_TF_carry/AUD/20210300, qty [1], fill [0]@ price, None Parent:30718 Children:no_children
... snip....
Enter order ID <RETURN for Cancel> 30787
Order now (Order ID:30787) Type best for medium_speed_TF_carry/AUD/20210300, qty [1], fill [0]@ price, None Parent:30718 Children:no_children
Quantity to fill (must be less than or equal to [1]) <RETURN for default [1]> 
Filled price 100
Fill datetime: Enter date and time in format %Y%-%m-%d eg '2020-05-30' OR '%Y-%m-%d %H:%M:%S' eg '2020-05-30 14:04:11' <RETURN for now>
2021-02-02:1045.03 {'type': '', 'component': 'mongoContractOrderStackData', 'strategy_name': 'medium_speed_TF_carry', 'instrument_code': 'AUD', 'contract_order_id': 30787, 'instrument_order_id': 30718}  Changed fill qty from [0] to [1] for order (Order ID:30787) Type best for medium_speed_TF_carry/AUD/20210300, qty [1], fill [0]@ price, None Parent:30718 Children:no_children

### NOTE: THE POSITIONS ARE UPDATED AT THIS POINT SO SHOULD MATCH

2021-02-02:1045.06 {'type': ''}  Updated position of AUD/20210300 from 0 to 1; new position in db is 1
2021-02-02:1045.08 {'type': ''}  Updated position of AUD/20210300 because of trade (Order ID:30787) Type best for medium_speed_TF_carry/AUD/20210300, qty [1], fill [0]@ price, None Parent:30718 Children:no_children ID:30787 with fills [1]

# THE FILL IS PASSED UP TO THE INSTRUMENT ORDER HERE

2021-02-02:1045.10 {'type': ''}  Updated position of medium_speed_TF_carry/AUD from 0 to 1 because of trade (Order ID:30718) Type best for medium_speed_TF_carry AUD, qty [1], fill [0]@ price, None Parent:no parent Children:[30787] 30718

2021-02-02:1045.12 {'type': '', 'component': 'mongoInstrumentOrderStackData', 'strategy_name': 'medium_speed_TF_carry', 
'instrument_code': 'AUD', 'instrument_order_id': 30718}  Changed fill qty from [0] to [1] for order (Order ID:30718) Type best for medium_speed_TF_carry AUD, qty [1], fill [0]@ price, None Parent:no parent Children:[30787]
Order now (Order ID:30787) Type best for medium_speed_TF_carry/AUD/20210300, qty [1], fill [1]@ price, 100.0 Parent:30718 Children:no_children INACTIVE

## ORDERS ARE NOW COMPLETED AND SHOULD HAVE GONE
rorymac commented 3 years ago

Rob Apologies, I had saved it, I did each order individually so it is a tad long, here is a zipped text file. manual_orders_output.txt.zip

robcarver17 commented 3 years ago

Are you definitely running with the latest version?

rorymac commented 3 years ago

No one back, I can fix that and run it again.

rorymac commented 3 years ago

Rob Here is what i have done. updated to latest from github. deleted DB restoremongo a mongodump of the csv created DB - production is clean (can send a zip of that if you need it) initialize capital : interactive_update_capital_manual update strategy capital: update_strategy_capital run systems: update_systems_backtest run order generator: update_strategy_orders got a critical error in that . see zipped txt file for the full output setup_full_output.txt.zip

robcarver17 commented 3 years ago

Update and run update_strategy_orders again (it will still break but hopefully more verbose error this time)

rorymac commented 3 years ago
rorym@mintservertwo:~/pysystemtrade$ git pull origin master
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 12 (delta 9), reused 12 (delta 9), pack-reused 0
Unpacking objects: 100% (12/12), 1.05 KiB | 89.00 KiB/s, done.
From https://github.com/robcarver17/pysystemtrade
 * branch            master     -> FETCH_HEAD
   f0292c9..48088cd  master     -> origin/master
Updating f0292c9..48088cd
Fast-forward
 examples/introduction/asimpletradingrule.py | 6 ++++--
 sysbrokers/IB/client/ib_contracts_client.py | 2 +-
 sysexecution/orders/base_orders.py          | 2 ++
 3 files changed, 7 insertions(+), 3 deletions(-)
rorym@mintservertwo:~/pysystemtrade$ 

Not much different :

rorym@mintservertwo:~/pysystemtrade/sysproduction/linux/scripts$ . update_strategy_orders 
/home/rorym/.local/lib/python3.8/site-packages/arctic/store/_pandas_ndarray_store.py:6: FutureWarning: The Panel class is removed from pandas. Accessing it from the top-level namespace will also be removed in the next version
  from pandas import DataFrame, Series, Panel

sysproduction.update_strategy_orders.update_strategy_orders:
None

Arguments:
[]

2021-02-03:1001.33 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': ''}  Upper 1.89 Lower 1.54 Current 0 Required position 2 Required trade 2 Reference price 135.090000  for contract 20210300
2021-02-03:1001.33 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CAC', 'instrument_order_id': ''}  Upper 1.99 Lower 1.63 Current 0 Required position 2 Required trade 2 Reference price 5581.000000  for contract 20210200
2021-02-03:1001.33 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'COPPER', 'instrument_order_id': ''}  Upper 0.00 Lower 0.00 Current 0 Required position 0 Required trade 0 Reference price 3.523000  for contract 20210300
2021-02-03:1001.33 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CORN', 'instrument_order_id': ''}  Upper 5.11 Lower 4.18 Current 0 Required position 4 Required trade 4 Reference price 446.500000  for contract 20211200
2021-02-03:1001.33 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CRUDE_W', 'instrument_order_id': ''}  Upper 0.00 Lower 0.00 Current 0 Required position 0 Required trade 0 Reference price 51.730000  for contract 20211200
2021-02-03:1001.33 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EDOLLAR', 'instrument_order_id': ''}  Upper 13.13 Lower 10.75 Current 0 Required position 11 Required trade 11 Reference price 99.285000  for contract 20240300
2021-02-03:1001.34 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EUROSTX', 'instrument_order_id': ''}  Upper 3.99 Lower 3.26 Current 0 Required position 3 Required trade 3 Reference price 3596.000000  for contract 20210300
2021-02-03:1001.34 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GAS_US', 'instrument_order_id': ''}  Upper -0.72 Lower -0.88 Current 0 Required position -1 Required trade -1 Reference price 2.800000  for contract 20210400
2021-02-03:1001.34 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GBP', 'instrument_order_id': ''}  Upper 2.26 Lower 1.85 Current 0 Required position 2 Required trade 2 Reference price 1.366500  for contract 20210300
2021-02-03:1001.34 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'LEANHOG', 'instrument_order_id': ''}  Upper 0.31 Lower 0.25 Current 0 Required position 0 Required trade 0 Reference price 78.125000  for contract 20210400
2021-02-03:1001.34 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'MXP', 'instrument_order_id': ''}  Upper 3.00 Lower 2.45 Current 0 Required position 2 Required trade 2 Reference price 0.049450  for contract 20210300
2021-02-03:1001.34 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'PLAT', 'instrument_order_id': ''}  Upper 0.00 Lower 0.00 Current 0 Required position 0 Required trade 0 Reference price 1100.700000  for contract 20210400
2021-02-03:1001.34 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'US2', 'instrument_order_id': ''}  Upper 46.41 Lower 37.97 Current 0 Required position 38 Required trade 38 Reference price 110.488281  for contract 20210300
2021-02-03:1001.34 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'V2X', 'instrument_order_id': ''}  Upper -0.72 Lower -0.88 Current 0 Required position -1 Required trade -1 Reference price 25.550000  for contract 20210400
2021-02-03:1001.34 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'VIX', 'instrument_order_id': ''}  Upper 0.32 Lower 0.27 Current 0 Required position 0 Required trade 0 Reference price 29.150000  for contract 20210400
2021-02-03:1001.34 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 BOBL, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1001.35 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': ''} *CRITICAL* Something went very wrong when submitting order (Order ID:no order ID) Type best for live_300 BOBL, qty [2], fill [0]@ price, None Parent:no parent Children:no_children!
2021-02-03:1001.35 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CAC', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 CAC, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1001.35 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CAC', 'instrument_order_id': ''} *CRITICAL* Something went very wrong when submitting order (Order ID:no order ID) Type best for live_300 CAC, qty [2], fill [0]@ price, None Parent:no parent Children:no_children!
2021-02-03:1001.35 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'COPPER', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 COPPER, qty [0], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1001.35 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'COPPER', 'instrument_order_id': ''} *CRITICAL* Something went very wrong when submitting order (Order ID:no order ID) Type best for live_300 COPPER, qty [0], fill [0]@ price, None Parent:no parent Children:no_children!
2021-02-03:1001.35 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CORN', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 CORN, qty [4], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1001.35 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CORN', 'instrument_order_id': ''} *CRITICAL* Something went very wrong when submitting order (Order ID:no order ID) Type best for live_300 CORN, qty [4], fill [0]@ price, None Parent:no parent Children:no_children!
2021-02-03:1001.35 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CRUDE_W', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 CRUDE_W, qty [0], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1001.35 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CRUDE_W', 'instrument_order_id': ''} *CRITICAL* Something went very wrong when submitting order (Order ID:no order ID) Type best for live_300 CRUDE_W, qty [0], fill [0]@ price, None Parent:no parent Children:no_children!
2021-02-03:1001.35 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EDOLLAR', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 EDOLLAR, qty [11], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1001.36 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EDOLLAR', 'instrument_order_id': ''} *CRITICAL* Something went very wrong when submitting order (Order ID:no order ID) Type best for live_300 EDOLLAR, qty [11], fill [0]@ price, None Parent:no parent Children:no_children!
2021-02-03:1001.36 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EUROSTX', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 EUROSTX, qty [3], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1001.36 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EUROSTX', 'instrument_order_id': ''} *CRITICAL* Something went very wrong when submitting order (Order ID:no order ID) Type best for live_300 EUROSTX, qty [3], fill [0]@ price, None Parent:no parent Children:no_children!
2021-02-03:1001.36 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GAS_US', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 GAS_US, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1001.36 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GAS_US', 'instrument_order_id': ''} *CRITICAL* Something went very wrong when submitting order (Order ID:no order ID) Type best for live_300 GAS_US, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children!
2021-02-03:1001.36 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GBP', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 GBP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1001.36 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GBP', 'instrument_order_id': ''} *CRITICAL* Something went very wrong when submitting order (Order ID:no order ID) Type best for live_300 GBP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children!
2021-02-03:1001.36 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'LEANHOG', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 LEANHOG, qty [0], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1001.36 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'LEANHOG', 'instrument_order_id': ''} *CRITICAL* Something went very wrong when submitting order (Order ID:no order ID) Type best for live_300 LEANHOG, qty [0], fill [0]@ price, None Parent:no parent Children:no_children!
2021-02-03:1001.36 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'MXP', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 MXP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1001.36 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'MXP', 'instrument_order_id': ''} *CRITICAL* Something went very wrong when submitting order (Order ID:no order ID) Type best for live_300 MXP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children!
2021-02-03:1001.37 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'PLAT', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 PLAT, qty [0], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1001.37 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'PLAT', 'instrument_order_id': ''} *CRITICAL* Something went very wrong when submitting order (Order ID:no order ID) Type best for live_300 PLAT, qty [0], fill [0]@ price, None Parent:no parent Children:no_children!
2021-02-03:1001.37 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'US2', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 US2, qty [38], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1001.37 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'US2', 'instrument_order_id': ''} *CRITICAL* Something went very wrong when submitting order (Order ID:no order ID) Type best for live_300 US2, qty [38], fill [0]@ price, None Parent:no parent Children:no_children!
2021-02-03:1001.37 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'V2X', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 V2X, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1001.37 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'V2X', 'instrument_order_id': ''} *CRITICAL* Something went very wrong when submitting order (Order ID:no order ID) Type best for live_300 V2X, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children!
2021-02-03:1001.37 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'VIX', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 VIX, qty [0], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1001.37 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'VIX', 'instrument_order_id': ''} *CRITICAL* Something went very wrong when submitting order (Order ID:no order ID) Type best for live_300 VIX, qty [0], fill [0]@ price, None Parent:no parent Children:no_children!
robcarver17 commented 3 years ago

That's because I'm an idiot that edited the wrong file. Sorry. try again.

rorymac commented 3 years ago

"don't be so hard on yourself Gomez, that's my job"

rorym@mintservertwo:~/pysystemtrade$ git pull origin master
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 5 (delta 4), reused 5 (delta 4), pack-reused 0
Unpacking objects: 100% (5/5), 422 bytes | 84.00 KiB/s, done.
From https://github.com/robcarver17/pysystemtrade
 * branch            master     -> FETCH_HEAD
   48088cd..df1f500  master     -> origin/master
Updating 48088cd..df1f500
Fast-forward
 sysexecution/strategies/strategy_order_handling.py | 3 ---
 1 file changed, 3 deletions(-)
rorym@mintservertwo:~/pysystemtrade$
rorym@mintservertwo:~/pysystemtrade/sysproduction/linux/scripts$ . update_strategy_orders 
/home/rorym/.local/lib/python3.8/site-packages/arctic/store/_pandas_ndarray_store.py:6: FutureWarning: The Panel class is removed from pandas. Accessing it from the top-level namespace will also be removed in the next version
  from pandas import DataFrame, Series, Panel

sysproduction.update_strategy_orders.update_strategy_orders:
None

Arguments:
[]

2021-02-03:1011.44 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': ''}  Upper 1.89 Lower 1.54 Current 0 Required position 2 Required trade 2 Reference price 135.090000  for contract 20210300
2021-02-03:1011.44 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CAC', 'instrument_order_id': ''}  Upper 1.99 Lower 1.63 Current 0 Required position 2 Required trade 2 Reference price 5581.000000  for contract 20210200
2021-02-03:1011.44 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'COPPER', 'instrument_order_id': ''}  Upper 0.00 Lower 0.00 Current 0 Required position 0 Required trade 0 Reference price 3.523000  for contract 20210300
2021-02-03:1011.44 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CORN', 'instrument_order_id': ''}  Upper 5.11 Lower 4.18 Current 0 Required position 4 Required trade 4 Reference price 446.500000  for contract 20211200
2021-02-03:1011.44 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CRUDE_W', 'instrument_order_id': ''}  Upper 0.00 Lower 0.00 Current 0 Required position 0 Required trade 0 Reference price 51.730000  for contract 20211200
2021-02-03:1011.44 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EDOLLAR', 'instrument_order_id': ''}  Upper 13.13 Lower 10.75 Current 0 Required position 11 Required trade 11 Reference price 99.285000  for contract 20240300
2021-02-03:1011.44 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EUROSTX', 'instrument_order_id': ''}  Upper 3.99 Lower 3.26 Current 0 Required position 3 Required trade 3 Reference price 3596.000000  for contract 20210300
2021-02-03:1011.44 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GAS_US', 'instrument_order_id': ''}  Upper -0.72 Lower -0.88 Current 0 Required position -1 Required trade -1 Reference price 2.800000  for contract 20210400
2021-02-03:1011.44 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GBP', 'instrument_order_id': ''}  Upper 2.26 Lower 1.85 Current 0 Required position 2 Required trade 2 Reference price 1.366500  for contract 20210300
2021-02-03:1011.45 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'LEANHOG', 'instrument_order_id': ''}  Upper 0.31 Lower 0.25 Current 0 Required position 0 Required trade 0 Reference price 78.125000  for contract 20210400
2021-02-03:1011.45 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'MXP', 'instrument_order_id': ''}  Upper 3.00 Lower 2.45 Current 0 Required position 2 Required trade 2 Reference price 0.049450  for contract 20210300
2021-02-03:1011.45 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'PLAT', 'instrument_order_id': ''}  Upper 0.00 Lower 0.00 Current 0 Required position 0 Required trade 0 Reference price 1100.700000  for contract 20210400
2021-02-03:1011.45 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'US2', 'instrument_order_id': ''}  Upper 46.41 Lower 37.97 Current 0 Required position 38 Required trade 38 Reference price 110.488281  for contract 20210300
2021-02-03:1011.45 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'V2X', 'instrument_order_id': ''}  Upper -0.72 Lower -0.88 Current 0 Required position -1 Required trade -1 Reference price 25.550000  for contract 20210400
2021-02-03:1011.45 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'VIX', 'instrument_order_id': ''}  Upper 0.32 Lower 0.27 Current 0 Required position 0 Required trade 0 Reference price 29.150000  for contract 20210400
2021-02-03:1011.45 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 BOBL, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
Traceback (most recent call last):
  File "run.py", line 64, in <module>
    func(*args, **kwargs)
  File "/home/rorym/pysystemtrade/sysproduction/update_strategy_orders.py", line 17, in update_strategy_orders
    strategy_order_generator.run_strategy_method()
  File "/home/rorym/pysystemtrade/syscontrol/strategy_tools.py", line 38, in run_strategy_method
    method()
  File "/home/rorym/pysystemtrade/sysexecution/strategies/strategy_order_handling.py", line 62, in get_and_place_orders
    self.submit_order_list(order_list_with_overrides)
  File "/home/rorym/pysystemtrade/sysexecution/strategies/strategy_order_handling.py", line 143, in submit_order_list
    self.submit_order(order)
  File "/home/rorym/pysystemtrade/sysexecution/strategies/strategy_order_handling.py", line 151, in submit_order
    order_id = self.order_stack.put_order_on_stack(cut_down_order)
  File "/home/rorym/pysystemtrade/sysexecution/order_stacks/instrument_order_stack.py", line 52, in put_order_on_stack
    existing_order_id_list = self._get_list_of_orderids_with_same_tradeable_object_on_stack(
  File "/home/rorym/pysystemtrade/sysexecution/order_stacks/order_stack.py", line 507, in _get_list_of_orderids_with_same_tradeable_object_on_stack
    existing_order_ids = self._get_list_of_order_ids_with_key_from_stack(
  File "/home/rorym/pysystemtrade/sysexecution/order_stacks/order_stack.py", line 519, in _get_list_of_order_ids_with_key_from_stack
    all_order_ids = self.get_list_of_order_ids(
  File "/home/rorym/pysystemtrade/sysexecution/order_stacks/order_stack.py", line 163, in get_list_of_order_ids
    order_ids = self._get_list_of_all_order_ids()
  File "/home/rorym/pysystemtrade/sysdata/mongodb/mongo_order_stack.py", line 60, in _get_list_of_all_order_ids
    order_ids.pop(order_ids.index(ORDER_ID_STORE_KEY))
ValueError: '_ORDER_ID_STORE_KEY' is not in list
robcarver17 commented 3 years ago

Phew that looks easy to fix. Try the latest push.

rorymac commented 3 years ago
rorym@mintservertwo:~/pysystemtrade$ git pull origin master
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 5 (delta 4), reused 5 (delta 4), pack-reused 0
Unpacking objects: 100% (5/5), 426 bytes | 60.00 KiB/s, done.
From https://github.com/robcarver17/pysystemtrade
 * branch            master     -> FETCH_HEAD
   df1f500..b65d464  master     -> origin/master
Updating df1f500..b65d464
Fast-forward
 sysdata/mongodb/mongo_order_stack.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rorym@mintservertwo:~/pysystemtrade/sysproduction/linux/scripts$ . update_strategy_orders 
/home/rorym/.local/lib/python3.8/site-packages/arctic/store/_pandas_ndarray_store.py:6: FutureWarning: The Panel class is removed from pandas. Accessing it from the top-level namespace will also be removed in the next version
  from pandas import DataFrame, Series, Panel

sysproduction.update_strategy_orders.update_strategy_orders:
None

Arguments:
[]

2021-02-03:1028.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': ''}  Upper 1.89 Lower 1.54 Current 0 Required position 2 Required trade 2 Reference price 135.090000  for contract 20210300
2021-02-03:1028.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CAC', 'instrument_order_id': ''}  Upper 1.99 Lower 1.63 Current 0 Required position 2 Required trade 2 Reference price 5581.000000  for contract 20210200
2021-02-03:1028.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'COPPER', 'instrument_order_id': ''}  Upper 0.00 Lower 0.00 Current 0 Required position 0 Required trade 0 Reference price 3.523000  for contract 20210300
2021-02-03:1028.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CORN', 'instrument_order_id': ''}  Upper 5.11 Lower 4.18 Current 0 Required position 4 Required trade 4 Reference price 446.500000  for contract 20211200
2021-02-03:1028.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CRUDE_W', 'instrument_order_id': ''}  Upper 0.00 Lower 0.00 Current 0 Required position 0 Required trade 0 Reference price 51.730000  for contract 20211200
2021-02-03:1028.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EDOLLAR', 'instrument_order_id': ''}  Upper 13.13 Lower 10.75 Current 0 Required position 11 Required trade 11 Reference price 99.285000  for contract 20240300
2021-02-03:1028.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EUROSTX', 'instrument_order_id': ''}  Upper 3.99 Lower 3.26 Current 0 Required position 3 Required trade 3 Reference price 3596.000000  for contract 20210300
2021-02-03:1028.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GAS_US', 'instrument_order_id': ''}  Upper -0.72 Lower -0.88 Current 0 Required position -1 Required trade -1 Reference price 2.800000  for contract 20210400
2021-02-03:1028.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GBP', 'instrument_order_id': ''}  Upper 2.26 Lower 1.85 Current 0 Required position 2 Required trade 2 Reference price 1.366500  for contract 20210300
2021-02-03:1028.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'LEANHOG', 'instrument_order_id': ''}  Upper 0.31 Lower 0.25 Current 0 Required position 0 Required trade 0 Reference price 78.125000  for contract 20210400
2021-02-03:1028.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'MXP', 'instrument_order_id': ''}  Upper 3.00 Lower 2.45 Current 0 Required position 2 Required trade 2 Reference price 0.049450  for contract 20210300
2021-02-03:1028.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'PLAT', 'instrument_order_id': ''}  Upper 0.00 Lower 0.00 Current 0 Required position 0 Required trade 0 Reference price 1100.700000  for contract 20210400
2021-02-03:1028.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'US2', 'instrument_order_id': ''}  Upper 46.41 Lower 37.97 Current 0 Required position 38 Required trade 38 Reference price 110.488281  for contract 20210300
2021-02-03:1028.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'V2X', 'instrument_order_id': ''}  Upper -0.72 Lower -0.88 Current 0 Required position -1 Required trade -1 Reference price 25.550000  for contract 20210400
2021-02-03:1028.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'VIX', 'instrument_order_id': ''}  Upper 0.32 Lower 0.27 Current 0 Required position 0 Required trade 0 Reference price 29.150000  for contract 20210400
2021-02-03:1028.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 BOBL, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
Traceback (most recent call last):
  File "run.py", line 64, in <module>
    func(*args, **kwargs)
  File "/home/rorym/pysystemtrade/sysproduction/update_strategy_orders.py", line 17, in update_strategy_orders
    strategy_order_generator.run_strategy_method()
  File "/home/rorym/pysystemtrade/syscontrol/strategy_tools.py", line 38, in run_strategy_method
    method()
  File "/home/rorym/pysystemtrade/sysexecution/strategies/strategy_order_handling.py", line 62, in get_and_place_orders
    self.submit_order_list(order_list_with_overrides)
  File "/home/rorym/pysystemtrade/sysexecution/strategies/strategy_order_handling.py", line 143, in submit_order_list
    self.submit_order(order)
  File "/home/rorym/pysystemtrade/sysexecution/strategies/strategy_order_handling.py", line 151, in submit_order
    order_id = self.order_stack.put_order_on_stack(cut_down_order)
  File "/home/rorym/pysystemtrade/sysexecution/order_stacks/instrument_order_stack.py", line 52, in put_order_on_stack
    existing_order_id_list = self._get_list_of_orderids_with_same_tradeable_object_on_stack(
  File "/home/rorym/pysystemtrade/sysexecution/order_stacks/order_stack.py", line 507, in _get_list_of_orderids_with_same_tradeable_object_on_stack
    existing_order_ids = self._get_list_of_order_ids_with_key_from_stack(
  File "/home/rorym/pysystemtrade/sysexecution/order_stacks/order_stack.py", line 519, in _get_list_of_order_ids_with_key_from_stack
    all_order_ids = self.get_list_of_order_ids(
  File "/home/rorym/pysystemtrade/sysexecution/order_stacks/order_stack.py", line 163, in get_list_of_order_ids
    order_ids = self._get_list_of_all_order_ids()
  File "/home/rorym/pysystemtrade/sysdata/mongodb/mongo_order_stack.py", line 60, in _get_list_of_all_order_ids
    order_ids.pop(order_ids.index(ORDER_ID_STORE_KEY), None)
ValueError: '_ORDER_ID_STORE_KEY' is not in list
robcarver17 commented 3 years ago

OK my fault for trying to be too clever. Committed an uglier fix that should work.

rorymac commented 3 years ago

Yes it does.

rorym@mintservertwo:~/pysystemtrade/sysproduction/linux/scripts$ . update_strategy_orders 
/home/rorym/.local/lib/python3.8/site-packages/arctic/store/_pandas_ndarray_store.py:6: FutureWarning: The Panel class is removed from pandas. Accessing it from the top-level namespace will also be removed in the next version
  from pandas import DataFrame, Series, Panel

sysproduction.update_strategy_orders.update_strategy_orders:
None

Arguments:
[]

2021-02-03:1033.09 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': ''}  Upper 1.89 Lower 1.54 Current 0 Required position 2 Required trade 2 Reference price 135.090000  for contract 20210300
2021-02-03:1033.09 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CAC', 'instrument_order_id': ''}  Upper 1.99 Lower 1.63 Current 0 Required position 2 Required trade 2 Reference price 5581.000000  for contract 20210200
2021-02-03:1033.09 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'COPPER', 'instrument_order_id': ''}  Upper 0.00 Lower 0.00 Current 0 Required position 0 Required trade 0 Reference price 3.523000  for contract 20210300
2021-02-03:1033.09 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CORN', 'instrument_order_id': ''}  Upper 5.11 Lower 4.18 Current 0 Required position 4 Required trade 4 Reference price 446.500000  for contract 20211200
2021-02-03:1033.09 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CRUDE_W', 'instrument_order_id': ''}  Upper 0.00 Lower 0.00 Current 0 Required position 0 Required trade 0 Reference price 51.730000  for contract 20211200
2021-02-03:1033.09 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EDOLLAR', 'instrument_order_id': ''}  Upper 13.13 Lower 10.75 Current 0 Required position 11 Required trade 11 Reference price 99.285000  for contract 20240300
2021-02-03:1033.09 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EUROSTX', 'instrument_order_id': ''}  Upper 3.99 Lower 3.26 Current 0 Required position 3 Required trade 3 Reference price 3596.000000  for contract 20210300
2021-02-03:1033.09 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GAS_US', 'instrument_order_id': ''}  Upper -0.72 Lower -0.88 Current 0 Required position -1 Required trade -1 Reference price 2.800000  for contract 20210400
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GBP', 'instrument_order_id': ''}  Upper 2.26 Lower 1.85 Current 0 Required position 2 Required trade 2 Reference price 1.366500  for contract 20210300
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'LEANHOG', 'instrument_order_id': ''}  Upper 0.31 Lower 0.25 Current 0 Required position 0 Required trade 0 Reference price 78.125000  for contract 20210400
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'MXP', 'instrument_order_id': ''}  Upper 3.00 Lower 2.45 Current 0 Required position 2 Required trade 2 Reference price 0.049450  for contract 20210300
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'PLAT', 'instrument_order_id': ''}  Upper 0.00 Lower 0.00 Current 0 Required position 0 Required trade 0 Reference price 1100.700000  for contract 20210400
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'US2', 'instrument_order_id': ''}  Upper 46.41 Lower 37.97 Current 0 Required position 38 Required trade 38 Reference price 110.488281  for contract 20210300
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'V2X', 'instrument_order_id': ''}  Upper -0.72 Lower -0.88 Current 0 Required position -1 Required trade -1 Reference price 25.550000  for contract 20210400
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'VIX', 'instrument_order_id': ''}  Upper 0.32 Lower 0.27 Current 0 Required position 0 Required trade 0 Reference price 29.150000  for contract 20210400
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 BOBL, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'BOBL', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 BOBL, qty [2], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 0 active orders
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': 2}  Added order (Order ID:no order ID) Type best for live_300 BOBL, qty [2], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 2
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CAC', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 CAC, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'CAC', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 CAC, qty [2], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 1 active orders
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CAC', 'instrument_order_id': 3}  Added order (Order ID:no order ID) Type best for live_300 CAC, qty [2], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 3
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'COPPER', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 COPPER, qty [0], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'COPPER', 'instrument_order_id': ''}  Zero orders not allowed
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'COPPER', 'instrument_order_id': ''} [Warning] Ignoring new order as eithier zero size or it replicates an existing order on the stack
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CORN', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 CORN, qty [4], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'CORN', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 CORN, qty [4], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 2 active orders
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CORN', 'instrument_order_id': 4}  Added order (Order ID:no order ID) Type best for live_300 CORN, qty [4], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 4
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CRUDE_W', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 CRUDE_W, qty [0], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'CRUDE_W', 'instrument_order_id': ''}  Zero orders not allowed
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CRUDE_W', 'instrument_order_id': ''} [Warning] Ignoring new order as eithier zero size or it replicates an existing order on the stack
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EDOLLAR', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 EDOLLAR, qty [11], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'EDOLLAR', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 EDOLLAR, qty [11], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 3 active orders
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EDOLLAR', 'instrument_order_id': 5}  Added order (Order ID:no order ID) Type best for live_300 EDOLLAR, qty [11], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 5
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EUROSTX', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 EUROSTX, qty [3], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'EUROSTX', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 EUROSTX, qty [3], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 4 active orders
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EUROSTX', 'instrument_order_id': 6}  Added order (Order ID:no order ID) Type best for live_300 EUROSTX, qty [3], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 6
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GAS_US', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 GAS_US, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'GAS_US', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 GAS_US, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 5 active orders
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GAS_US', 'instrument_order_id': 7}  Added order (Order ID:no order ID) Type best for live_300 GAS_US, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 7
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GBP', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 GBP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'GBP', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 GBP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 6 active orders
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GBP', 'instrument_order_id': 8}  Added order (Order ID:no order ID) Type best for live_300 GBP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 8
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'LEANHOG', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 LEANHOG, qty [0], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'LEANHOG', 'instrument_order_id': ''}  Zero orders not allowed
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'LEANHOG', 'instrument_order_id': ''} [Warning] Ignoring new order as eithier zero size or it replicates an existing order on the stack
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'MXP', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 MXP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'MXP', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 MXP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 7 active orders
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'MXP', 'instrument_order_id': 9}  Added order (Order ID:no order ID) Type best for live_300 MXP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 9
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'PLAT', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 PLAT, qty [0], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'PLAT', 'instrument_order_id': ''}  Zero orders not allowed
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'PLAT', 'instrument_order_id': ''} [Warning] Ignoring new order as eithier zero size or it replicates an existing order on the stack
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'US2', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 US2, qty [38], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'US2', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 US2, qty [38], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 8 active orders
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'US2', 'instrument_order_id': 10}  Added order (Order ID:no order ID) Type best for live_300 US2, qty [38], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 10
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'V2X', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 V2X, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'V2X', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 V2X, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 9 active orders
2021-02-03:1033.15 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'V2X', 'instrument_order_id': 11}  Added order (Order ID:no order ID) Type best for live_300 V2X, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 11
2021-02-03:1033.15 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'VIX', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 VIX, qty [0], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.15 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'VIX', 'instrument_order_id': ''}  Zero orders not allowed
2021-02-03:1033.15 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'VIX', 'instrument_order_id': ''} [Warning] Ignoring new order as eithier zero size or it replicates an existing order on the stack
rorym@mintservertwo:~/pysystemtrade/sysproduction/linux/scripts$ ls -la
robcarver17 commented 3 years ago

OK now try the manual fill process again.

rorymac commented 3 years ago

on to the next portion. 10: Spawn contract orders from instrument orders

rorym@mintservertwo:~/pysystemtrade/sysproduction/linux/scripts$ . update_strategy_orders 
/home/rorym/.local/lib/python3.8/site-packages/arctic/store/_pandas_ndarray_store.py:6: FutureWarning: The Panel class is removed from pandas. Accessing it from the top-level namespace will also be removed in the next version
  from pandas import DataFrame, Series, Panel

sysproduction.update_strategy_orders.update_strategy_orders:
None

Arguments:
[]

2021-02-03:1033.09 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': ''}  Upper 1.89 Lower 1.54 Current 0 Required position 2 Required trade 2 Reference price 135.090000  for contract 20210300
2021-02-03:1033.09 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CAC', 'instrument_order_id': ''}  Upper 1.99 Lower 1.63 Current 0 Required position 2 Required trade 2 Reference price 5581.000000  for contract 20210200
2021-02-03:1033.09 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'COPPER', 'instrument_order_id': ''}  Upper 0.00 Lower 0.00 Current 0 Required position 0 Required trade 0 Reference price 3.523000  for contract 20210300
2021-02-03:1033.09 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CORN', 'instrument_order_id': ''}  Upper 5.11 Lower 4.18 Current 0 Required position 4 Required trade 4 Reference price 446.500000  for contract 20211200
2021-02-03:1033.09 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CRUDE_W', 'instrument_order_id': ''}  Upper 0.00 Lower 0.00 Current 0 Required position 0 Required trade 0 Reference price 51.730000  for contract 20211200
2021-02-03:1033.09 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EDOLLAR', 'instrument_order_id': ''}  Upper 13.13 Lower 10.75 Current 0 Required position 11 Required trade 11 Reference price 99.285000  for contract 20240300
2021-02-03:1033.09 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EUROSTX', 'instrument_order_id': ''}  Upper 3.99 Lower 3.26 Current 0 Required position 3 Required trade 3 Reference price 3596.000000  for contract 20210300
2021-02-03:1033.09 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GAS_US', 'instrument_order_id': ''}  Upper -0.72 Lower -0.88 Current 0 Required position -1 Required trade -1 Reference price 2.800000  for contract 20210400
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GBP', 'instrument_order_id': ''}  Upper 2.26 Lower 1.85 Current 0 Required position 2 Required trade 2 Reference price 1.366500  for contract 20210300
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'LEANHOG', 'instrument_order_id': ''}  Upper 0.31 Lower 0.25 Current 0 Required position 0 Required trade 0 Reference price 78.125000  for contract 20210400
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'MXP', 'instrument_order_id': ''}  Upper 3.00 Lower 2.45 Current 0 Required position 2 Required trade 2 Reference price 0.049450  for contract 20210300
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'PLAT', 'instrument_order_id': ''}  Upper 0.00 Lower 0.00 Current 0 Required position 0 Required trade 0 Reference price 1100.700000  for contract 20210400
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'US2', 'instrument_order_id': ''}  Upper 46.41 Lower 37.97 Current 0 Required position 38 Required trade 38 Reference price 110.488281  for contract 20210300
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'V2X', 'instrument_order_id': ''}  Upper -0.72 Lower -0.88 Current 0 Required position -1 Required trade -1 Reference price 25.550000  for contract 20210400
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'VIX', 'instrument_order_id': ''}  Upper 0.32 Lower 0.27 Current 0 Required position 0 Required trade 0 Reference price 29.150000  for contract 20210400
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 BOBL, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'BOBL', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 BOBL, qty [2], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 0 active orders
2021-02-03:1033.10 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': 2}  Added order (Order ID:no order ID) Type best for live_300 BOBL, qty [2], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 2
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CAC', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 CAC, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'CAC', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 CAC, qty [2], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 1 active orders
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CAC', 'instrument_order_id': 3}  Added order (Order ID:no order ID) Type best for live_300 CAC, qty [2], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 3
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'COPPER', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 COPPER, qty [0], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'COPPER', 'instrument_order_id': ''}  Zero orders not allowed
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'COPPER', 'instrument_order_id': ''} [Warning] Ignoring new order as eithier zero size or it replicates an existing order on the stack
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CORN', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 CORN, qty [4], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'CORN', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 CORN, qty [4], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 2 active orders
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CORN', 'instrument_order_id': 4}  Added order (Order ID:no order ID) Type best for live_300 CORN, qty [4], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 4
2021-02-03:1033.11 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CRUDE_W', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 CRUDE_W, qty [0], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'CRUDE_W', 'instrument_order_id': ''}  Zero orders not allowed
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'CRUDE_W', 'instrument_order_id': ''} [Warning] Ignoring new order as eithier zero size or it replicates an existing order on the stack
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EDOLLAR', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 EDOLLAR, qty [11], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'EDOLLAR', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 EDOLLAR, qty [11], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 3 active orders
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EDOLLAR', 'instrument_order_id': 5}  Added order (Order ID:no order ID) Type best for live_300 EDOLLAR, qty [11], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 5
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EUROSTX', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 EUROSTX, qty [3], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'EUROSTX', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 EUROSTX, qty [3], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 4 active orders
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'EUROSTX', 'instrument_order_id': 6}  Added order (Order ID:no order ID) Type best for live_300 EUROSTX, qty [3], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 6
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GAS_US', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 GAS_US, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.12 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'GAS_US', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 GAS_US, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 5 active orders
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GAS_US', 'instrument_order_id': 7}  Added order (Order ID:no order ID) Type best for live_300 GAS_US, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 7
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GBP', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 GBP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'GBP', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 GBP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 6 active orders
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'GBP', 'instrument_order_id': 8}  Added order (Order ID:no order ID) Type best for live_300 GBP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 8
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'LEANHOG', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 LEANHOG, qty [0], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'LEANHOG', 'instrument_order_id': ''}  Zero orders not allowed
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'LEANHOG', 'instrument_order_id': ''} [Warning] Ignoring new order as eithier zero size or it replicates an existing order on the stack
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'MXP', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 MXP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.13 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'MXP', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 MXP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 7 active orders
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'MXP', 'instrument_order_id': 9}  Added order (Order ID:no order ID) Type best for live_300 MXP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 9
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'PLAT', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 PLAT, qty [0], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'PLAT', 'instrument_order_id': ''}  Zero orders not allowed
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'PLAT', 'instrument_order_id': ''} [Warning] Ignoring new order as eithier zero size or it replicates an existing order on the stack
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'US2', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 US2, qty [38], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'US2', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 US2, qty [38], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 8 active orders
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'US2', 'instrument_order_id': 10}  Added order (Order ID:no order ID) Type best for live_300 US2, qty [38], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 10
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'V2X', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 V2X, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.14 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'V2X', 'instrument_order_id': ''}  New order (Order ID:no order ID) Type best for live_300 V2X, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children putting on Instrument order stack: mongoData connection for INSTRUMENT_ORDER_STACK, mongodb production/INSTRUMENT_ORDER_STACK @ localhost -p 27017  with 9 active orders
2021-02-03:1033.15 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'V2X', 'instrument_order_id': 11}  Added order (Order ID:no order ID) Type best for live_300 V2X, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children to instrument order stack with order id 11
2021-02-03:1033.15 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'VIX', 'instrument_order_id': ''}  Required order (Order ID:no order ID) Type best for live_300 VIX, qty [0], fill [0]@ price, None Parent:no parent Children:no_children
2021-02-03:1033.15 {'type': '', 'strategy_name': 'live_300', 'component': 'mongoInstrumentOrderStackData', 'instrument_code': 'VIX', 'instrument_order_id': ''}  Zero orders not allowed
2021-02-03:1033.15 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'VIX', 'instrument_order_id': ''} [Warning] Ignoring new order as eithier zero size or it replicates an existing order on the stack
rorym@mintservertwo:~/pysystemtrade/sysproduction/linux/scripts$ ls -la
total 136
drwxrwxr-x 2 rorym rorym 4096 Jan 19 14:15 .
drwxrwxr-x 3 rorym rorym 4096 Nov 14 14:14 ..
-rwxrwxr-x 1 rorym rorym   84 Nov 14 14:14 backup_arctic_to_csv
-rw-rw-r-- 1 rorym rorym   94 Dec 13 10:06 backup_mongo_data_as_dump
-rw-rw-r-- 1 rorym rorym   80 Dec 13 10:06 backup_state_files
-rw-rw-r-- 1 rorym rorym  104 Nov 14 14:14 clean_truncate_backtest_states
-rwxrwxr-x 1 rorym rorym   94 Nov 14 14:14 clean_truncate_echo_files
-rwxrwxr-x 1 rorym rorym   92 Nov 14 14:14 clean_truncate_log_files
-rwxrwxr-x 1 rorym rorym    0 Nov 14 14:14 __init__.py
-rw-rw-r-- 1 rorym rorym   84 Nov 14 14:14 interactive_controls
-rw-rw-r-- 1 rorym rorym   90 Nov 14 14:14 interactive_diagnostics
-rw-rw-r-- 1 rorym rorym  113 Nov 14 14:14 interactive_manual_check_fx_prices
-rw-rw-r-- 1 rorym rorym  129 Nov 14 14:14 interactive_manual_check_historical_prices
-rw-rw-r-- 1 rorym rorym   90 Nov 14 14:14 interactive_order_stack
-rw-rw-r-- 1 rorym rorym  110 Nov 14 14:14 interactive_update_capital_manual
-rwxrwxr-x 1 rorym rorym  104 Nov 14 14:14 interactive_update_roll_status
-rwxrwxr-x 1 rorym rorym   30 Nov 14 14:14 p
-rwxrwxr-x 1 rorym rorym   66 Dec 13 10:06 run_backups
-rwxrwxr-x 1 rorym rorym   80 Dec 13 10:06 run_capital_update
-rwxrwxr-x 1 rorym rorym   68 Dec 13 10:06 run_cleaners
-rwxrwxr-x 1 rorym rorym   90 Dec 13 10:06 run_daily_price_updates
-rwxrwxr-x 1 rorym rorym 1644 Nov 14 14:14 run.py
-rwxrwxr-x 1 rorym rorym   66 Dec 13 10:06 run_reports
-rwxrwxr-x 1 rorym rorym   78 Dec 13 10:06 run_stack_handler
-rwxrwxr-x 1 rorym rorym  100 Dec 13 10:06 run_strategy_order_generator
-rwxrwxr-x 1 rorym rorym   66 Dec 13 10:06 run_systems
-rwxrwxr-x 1 rorym rorym   58 Dec 13 10:06 startup
-rwxrwxr-x 1 rorym rorym   76 Nov 14 14:14 update_fx_prices
-rwxrwxr-x 1 rorym rorym   93 Nov 14 14:14 update_historical_prices
-rwxrwxr-x 1 rorym rorym  107 Nov 14 14:14 update_multiple_adjusted_prices
-rwxrwxr-x 1 rorym rorym   92 Nov 14 14:14 update_sampled_contracts
-rw-rw-r-- 1 rorym rorym   90 Nov 14 14:14 update_strategy_capital
-rw-rw-r-- 1 rorym rorym   88 Dec 13 10:06 update_strategy_orders
-rw-rw-r-- 1 rorym rorym   90 Dec 13 10:06 update_system_backtests
-rw-rw-r-- 1 rorym rorym   84 Nov 14 14:14 update_total_capital
rorym@mintservertwo:~/pysystemtrade/sysproduction/linux/scripts$ . interactive_order_stack 
/home/rorym/.local/lib/python3.8/site-packages/arctic/store/_pandas_ndarray_store.py:6: FutureWarning: The Panel class is removed from pandas. Accessing it from the top-level namespace will also be removed in the next version
  from pandas import DataFrame, Series, Panel

sysproduction.interactive_order_stack.interactive_order_stack:
None

Arguments:
[]

0: View
1: Create orders
2: Fills and completions
3: Netting, cancellation and locks
4: Delete and clean

Your choice? <RETURN for EXIT> 1
10: Spawn contract orders from instrument orders
11: Create force roll contract orders
12: Create (and try to execute...) IB broker orders
13: Balance trade: Create a series of trades and immediately fill them (not actually executed)
14: Balance instrument trade: Create a trade just at the strategy level and fill (not actually executed)
15: Manual trade: Create a series of trades to be executed
16: Cash FX trade

Your choice? <RETURN for Back> 10
This will create contract orders for any instrument orders that don't have them
Instrument orders:

INSTRUMENT STACK 

(Order ID:2) Type best for live_300 BOBL, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
(Order ID:3) Type best for live_300 CAC, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
(Order ID:4) Type best for live_300 CORN, qty [4], fill [0]@ price, None Parent:no parent Children:no_children
(Order ID:5) Type best for live_300 EDOLLAR, qty [11], fill [0]@ price, None Parent:no parent Children:no_children
(Order ID:6) Type best for live_300 EUROSTX, qty [3], fill [0]@ price, None Parent:no parent Children:no_children
(Order ID:7) Type best for live_300 GAS_US, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children
(Order ID:8) Type best for live_300 GBP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
(Order ID:9) Type best for live_300 MXP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
(Order ID:10) Type best for live_300 US2, qty [38], fill [0]@ price, None Parent:no parent Children:no_children
(Order ID:11) Type best for live_300 V2X, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children
Which instrument order ID <RETURN for All> 
Are you sure? (Y/other)Y
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
2021-02-03:1036.28 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': 2}  No roll, allocating entire order (Order ID:2) Type best for live_300 BOBL, qty [2], fill [0]@ price, None Parent:no parent Children:no_children to current contract 20210300
2021-02-03:1036.28 {'type': '', 'component': 'mongoIbBrokerClientIdData'}  Locked IB client ID 8
2021-02-03:1036.36 {'type': '', 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'contract_order_id': '', 'instrument_order_id': 2}  'Best' order so allocating to original_best
2021-02-03:1036.36 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': 2}  List of contract orders spawned [(Order ID:no order ID) Type best for live_300/BOBL/20210300, qty [2], fill [0]@ price, None Parent:2 Children:no_children]
2021-02-03:1036.36 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'BOBL', 'instrument_order_id': 2, 'contract_order_id': ''}  Put child order (Order ID:no order ID) Type best for live_300/BOBL/20210300, qty [2], fill [0]@ price, None Parent:2 Children:no_children LOCKED on stack with ID 2 from parent order (Order ID:2) Type best for live_300 BOBL, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
2021-02-03:1036.36 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'CAC', 'instrument_order_id': 3}  No roll, allocating entire order (Order ID:3) Type best for live_300 CAC, qty [2], fill [0]@ price, None Parent:no parent Children:no_children to current contract 20210200
2021-02-03:1036.37 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'CAC', 'contract_order_id': '', 'instrument_order_id': 3}  'Best' order so allocating to original_best
2021-02-03:1036.37 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'CAC', 'instrument_order_id': 3}  List of contract orders spawned [(Order ID:no order ID) Type best for live_300/CAC/20210200, qty [2], fill [0]@ price, None Parent:3 Children:no_children]
2021-02-03:1036.37 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'CAC', 'instrument_order_id': 3, 'contract_order_id': ''}  Put child order (Order ID:no order ID) Type best for live_300/CAC/20210200, qty [2], fill [0]@ price, None Parent:3 Children:no_children LOCKED on stack with ID 3 from parent order (Order ID:3) Type best for live_300 CAC, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
2021-02-03:1036.38 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'CORN', 'instrument_order_id': 4}  No roll, allocating entire order (Order ID:4) Type best for live_300 CORN, qty [4], fill [0]@ price, None Parent:no parent Children:no_children to current contract 20211200
2021-02-03:1036.38 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'CORN', 'contract_order_id': '', 'instrument_order_id': 4}  'Best' order so allocating to original_best
2021-02-03:1036.38 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'CORN', 'instrument_order_id': 4}  List of contract orders spawned [(Order ID:no order ID) Type best for live_300/CORN/20211200, qty [4], fill [0]@ price, None Parent:4 Children:no_children]
2021-02-03:1036.38 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'CORN', 'instrument_order_id': 4, 'contract_order_id': ''}  Put child order (Order ID:no order ID) Type best for live_300/CORN/20211200, qty [4], fill [0]@ price, None Parent:4 Children:no_children LOCKED on stack with ID 4 from parent order (Order ID:4) Type best for live_300 CORN, qty [4], fill [0]@ price, None Parent:no parent Children:no_children
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
2021-02-03:1036.38 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'EDOLLAR', 'instrument_order_id': 5}  No roll, allocating entire order (Order ID:5) Type best for live_300 EDOLLAR, qty [11], fill [0]@ price, None Parent:no parent Children:no_children to current contract 20240300
2021-02-03:1036.39 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'EDOLLAR', 'contract_order_id': '', 'instrument_order_id': 5}  'Best' order so allocating to original_best
2021-02-03:1036.39 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'EDOLLAR', 'instrument_order_id': 5}  List of contract orders spawned [(Order ID:no order ID) Type best for live_300/EDOLLAR/20240300, qty [11], fill [0]@ price, None Parent:5 Children:no_children]
2021-02-03:1036.39 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'EDOLLAR', 'instrument_order_id': 5, 'contract_order_id': ''}  Put child order (Order ID:no order ID) Type best for live_300/EDOLLAR/20240300, qty [11], fill [0]@ price, None Parent:5 Children:no_children LOCKED on stack with ID 5 from parent order (Order ID:5) Type best for live_300 EDOLLAR, qty [11], fill [0]@ price, None Parent:no parent Children:no_children
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
2021-02-03:1036.39 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'EUROSTX', 'instrument_order_id': 6}  No roll, allocating entire order (Order ID:6) Type best for live_300 EUROSTX, qty [3], fill [0]@ price, None Parent:no parent Children:no_children to current contract 20210300
2021-02-03:1036.40 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'EUROSTX', 'contract_order_id': '', 'instrument_order_id': 6}  'Best' order so allocating to original_best
2021-02-03:1036.40 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'EUROSTX', 'instrument_order_id': 6}  List of contract orders spawned [(Order ID:no order ID) Type best for live_300/EUROSTX/20210300, qty [3], fill [0]@ price, None Parent:6 Children:no_children]
2021-02-03:1036.40 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'EUROSTX', 'instrument_order_id': 6, 'contract_order_id': ''}  Put child order (Order ID:no order ID) Type best for live_300/EUROSTX/20210300, qty [3], fill [0]@ price, None Parent:6 Children:no_children LOCKED on stack with ID 6 from parent order (Order ID:6) Type best for live_300 EUROSTX, qty [3], fill [0]@ price, None Parent:no parent Children:no_children
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
2021-02-03:1036.40 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'GAS_US', 'instrument_order_id': 7}  No roll, allocating entire order (Order ID:7) Type best for live_300 GAS_US, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children to current contract 20210400
2021-02-03:1036.41 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'GAS_US', 'contract_order_id': '', 'instrument_order_id': 7}  'Best' order so allocating to original_best
2021-02-03:1036.41 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'GAS_US', 'instrument_order_id': 7}  List of contract orders spawned [(Order ID:no order ID) Type best for live_300/GAS_US/20210400, qty [-1], fill [0]@ price, None Parent:7 Children:no_children]
2021-02-03:1036.41 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'GAS_US', 'instrument_order_id': 7, 'contract_order_id': ''}  Put child order (Order ID:no order ID) Type best for live_300/GAS_US/20210400, qty [-1], fill [0]@ price, None Parent:7 Children:no_children LOCKED on stack with ID 7 from parent order (Order ID:7) Type best for live_300 GAS_US, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
2021-02-03:1036.41 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'GBP', 'instrument_order_id': 8}  No roll, allocating entire order (Order ID:8) Type best for live_300 GBP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children to current contract 20210300
2021-02-03:1036.42 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'GBP', 'contract_order_id': '', 'instrument_order_id': 8}  'Best' order so allocating to original_best
2021-02-03:1036.42 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'GBP', 'instrument_order_id': 8}  List of contract orders spawned [(Order ID:no order ID) Type best for live_300/GBP/20210300, qty [2], fill [0]@ price, None Parent:8 Children:no_children]
2021-02-03:1036.42 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'GBP', 'instrument_order_id': 8, 'contract_order_id': ''}  Put child order (Order ID:no order ID) Type best for live_300/GBP/20210300, qty [2], fill [0]@ price, None Parent:8 Children:no_children LOCKED on stack with ID 8 from parent order (Order ID:8) Type best for live_300 GBP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
2021-02-03:1036.42 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'MXP', 'instrument_order_id': 9}  No roll, allocating entire order (Order ID:9) Type best for live_300 MXP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children to current contract 20210300
2021-02-03:1036.42 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'MXP', 'contract_order_id': '', 'instrument_order_id': 9}  'Best' order so allocating to original_best
2021-02-03:1036.43 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'MXP', 'instrument_order_id': 9}  List of contract orders spawned [(Order ID:no order ID) Type best for live_300/MXP/20210300, qty [2], fill [0]@ price, None Parent:9 Children:no_children]
2021-02-03:1036.43 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'MXP', 'instrument_order_id': 9, 'contract_order_id': ''}  Put child order (Order ID:no order ID) Type best for live_300/MXP/20210300, qty [2], fill [0]@ price, None Parent:9 Children:no_children LOCKED on stack with ID 9 from parent order (Order ID:9) Type best for live_300 MXP, qty [2], fill [0]@ price, None Parent:no parent Children:no_children
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
2021-02-03:1036.43 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'US2', 'instrument_order_id': 10}  No roll, allocating entire order (Order ID:10) Type best for live_300 US2, qty [38], fill [0]@ price, None Parent:no parent Children:no_children to current contract 20210300
2021-02-03:1036.43 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'US2', 'contract_order_id': '', 'instrument_order_id': 10}  'Best' order so allocating to original_best
2021-02-03:1036.43 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'US2', 'instrument_order_id': 10}  List of contract orders spawned [(Order ID:no order ID) Type best for live_300/US2/20210300, qty [38], fill [0]@ price, None Parent:10 Children:no_children]
2021-02-03:1036.44 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'US2', 'instrument_order_id': 10, 'contract_order_id': ''}  Put child order (Order ID:no order ID) Type best for live_300/US2/20210300, qty [38], fill [0]@ price, None Parent:10 Children:no_children LOCKED on stack with ID 10 from parent order (Order ID:10) Type best for live_300 US2, qty [38], fill [0]@ price, None Parent:no parent Children:no_children
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
Library created, but couldn't enable sharding: no such command: 'enablesharding', full error: {'ok': 0.0, 'errmsg': "no such command: 'enablesharding'", 'code': 59, 'codeName': 'CommandNotFound'}. This is OK if you're not 'admin'
2021-02-03:1036.44 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'V2X', 'instrument_order_id': 11}  No roll, allocating entire order (Order ID:11) Type best for live_300 V2X, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children to current contract 20210400
2021-02-03:1036.44 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'V2X', 'contract_order_id': '', 'instrument_order_id': 11}  'Best' order so allocating to original_best
2021-02-03:1036.44 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'V2X', 'instrument_order_id': 11}  List of contract orders spawned [(Order ID:no order ID) Type best for live_300/V2X/20210400, qty [-1], fill [0]@ price, None Parent:11 Children:no_children]
2021-02-03:1036.44 {'type': '', 'broker': 'IB', 'clientid': 8, 'strategy_name': 'live_300', 'instrument_code': 'V2X', 'instrument_order_id': 11, 'contract_order_id': ''}  Put child order (Order ID:no order ID) Type best for live_300/V2X/20210400, qty [-1], fill [0]@ price, None Parent:11 Children:no_children LOCKED on stack with ID 11 from parent order (Order ID:11) Type best for live_300 V2X, qty [-1], fill [0]@ price, None Parent:no parent Children:no_children
If you are trading manually, you should now view the contract order stack and trade.
Then create manual fills for contract orders
10: Spawn contract orders from instrument orders
11: Create force roll contract orders
12: Create (and try to execute...) IB broker orders
13: Balance trade: Create a series of trades and immediately fill them (not actually executed)
14: Balance instrument trade: Create a trade just at the strategy level and fill (not actually executed)
15: Manual trade: Create a series of trades to be executed
16: Cash FX trade

Your choice? <RETURN for Back> 
rorymac commented 3 years ago

checking the stack

Your choice? <RETURN for EXIT> 0
0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions

Your choice? <RETURN for Back> 2

CONTRACT STACK 

(Order ID:2) Type best for live_300/BOBL/20210300, qty [2], fill [0]@ price, None Parent:2 Children:no_children
(Order ID:3) Type best for live_300/CAC/20210200, qty [2], fill [0]@ price, None Parent:3 Children:no_children
(Order ID:4) Type best for live_300/CORN/20211200, qty [4], fill [0]@ price, None Parent:4 Children:no_children
(Order ID:5) Type best for live_300/EDOLLAR/20240300, qty [11], fill [0]@ price, None Parent:5 Children:no_children
(Order ID:6) Type best for live_300/EUROSTX/20210300, qty [3], fill [0]@ price, None Parent:6 Children:no_children
(Order ID:7) Type best for live_300/GAS_US/20210400, qty [-1], fill [0]@ price, None Parent:7 Children:no_children
(Order ID:8) Type best for live_300/GBP/20210300, qty [2], fill [0]@ price, None Parent:8 Children:no_children
(Order ID:9) Type best for live_300/MXP/20210300, qty [2], fill [0]@ price, None Parent:9 Children:no_children
(Order ID:10) Type best for live_300/US2/20210300, qty [38], fill [0]@ price, None Parent:10 Children:no_children
(Order ID:11) Type best for live_300/V2X/20210400, qty [-1], fill [0]@ price, None Parent:11 Children:no_children
0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions

Your choice? <RETURN for Back> 
rorymac commented 3 years ago

Will do the manual trades and show that, going to use the existing position at the average holding price a few secs to get all those details.

rorymac commented 3 years ago

All appeared to work, though a small glitch.. look at CAC tried to input it as two orders of 1 each it took the first one but not the second.

long so have zipped the output.

order.txt.zip

rorymac commented 3 years ago

The original problem appears to be solved. (I am getting contract positions)

As the CAC appears to be a minor issue for the time being I went and edited the documents directly in the DB. (CAC only) All positions balance. (to fix the CAC issue)

Your choice? <RETURN for Back> 9
2021-02-03:1202.18 {'type': '', 'component': 'mongoIbBrokerClientIdData'}  Locked IB client ID 9
Optimal vs actual
                  current        optimal  breaks
live_300 BOBL           2    1.543/1.886   False
live_300 CAC            2    1.629/1.992   False
live_300 COPPER         0    0.000/0.000   False
live_300 CORN           4    4.178/5.106   False
live_300 CRUDE_W        0    0.000/0.000   False
live_300 EDOLLAR       11  10.746/13.134   False
live_300 EUROSTX        3    3.263/3.988   False
live_300 GAS_US        -1  -0.876/-0.716   False
live_300 GBP            2    1.850/2.261   False
live_300 LEANHOG        0    0.252/0.308   False
live_300 MXP            2    2.454/2.999   False
live_300 PLAT           0    0.000/0.000   False
live_300 US2           38  37.973/46.411   False
live_300 V2X           -1  -0.882/-0.722   False
live_300 VIX            0    0.265/0.324   False
Strategy positions
  strategy_name instrument_code  position
0      live_300            BOBL         2
1      live_300             CAC         2
2      live_300            CORN         4
3      live_300         EDOLLAR        11
4      live_300         EUROSTX         3
5      live_300          GAS_US        -1
6      live_300             GBP         2
7      live_300             MXP         2
8      live_300             US2        38
9      live_300             V2X        -1

 Contract level positions
  instrument_code contract_date          expiry_date  position
0            BOBL      20210308  2021-03-08 00:00:00       2.0
1             CAC      20210219  2021-02-19 00:00:00       2.0
2            CORN      20211214  2021-12-14 00:00:00       4.0
3         EDOLLAR      20240318  2024-03-18 00:00:00      11.0
4         EUROSTX      20210319  2021-03-19 00:00:00       3.0
5          GAS_US      20210329  2021-03-29 00:00:00      -1.0
6             GBP      20210315  2021-03-15 00:00:00       2.0
7             MXP      20210315  2021-03-15 00:00:00       2.0
8             US2      20210331  2021-03-31 00:00:00      38.0
9             V2X      20210421  2021-04-21 00:00:00      -1.0
(No breaks positions consistent)

 Broker positions
  instrument_code contract_date          expiry_date  position
8            BOBL      20210308  2021-03-08 00:00:00       2.0
2             CAC      20210219  2021-02-19 00:00:00       2.0
3            CORN      20211214  2021-12-14 00:00:00       4.0
6         EDOLLAR      20240318  2024-03-18 00:00:00      11.0
4         EUROSTX      20210319  2021-03-19 00:00:00       3.0
0          GAS_US      20210329  2021-03-29 00:00:00      -1.0
1             GBP      20210315  2021-03-15 00:00:00       2.0
9             MXP      20210315  2021-03-15 00:00:00       2.0
7             US2      20210331  2021-03-31 00:00:00      38.0
5             V2X      20210421  2021-04-21 00:00:00      -1.0
(No breaks positions consistent)
0: View specific order
1: View instrument order stack
2: View contract order stack
3: View broker order stack (stored local DB)
4: View IB orders and fills
9: View positions

Your choice? <RETURN for Back> 
0: View
1: Create orders
2: Fills and completions
3: Netting, cancellation and locks
4: Delete and clean

Your choice? <RETURN for EXIT> 
FINISHED

now I can proceed to the next step.
BUT it appears as though I do not have to pass the fills up they are all in the db... Or am I missing something?

I still need to do the handle completed orders and end of day .

robcarver17 commented 3 years ago

The latest code does all that automatically after a fill is done. So the order stack should be empty and nothing else needs doing. I will edit the docs. I am a bit worried about the manual hacking though but closing the issue if solved.

rorymac commented 3 years ago

Rob As a fine and gracious BDL, you are under appreciated thank you for sorting this out. The hack was pretty simple as I could follow though the documents and I now have a finer understanding of how you have put the stack together.

Just to be sure, do I need to run the end of day?

robcarver17 commented 3 years ago

Probably not - if all the stacks are already empty then the end of day won't do anything.