Closed NikolaR01 closed 3 years ago
that are calculated using hard coded values of 0 and 1
Typically these vaues would not be hardcoded but depend on the allocations taken. Maybe worth checking in debug mode as variable value should be changing.
@NikolaR01 - please can you add links to the specific lines of code that are hardcoded and/or a feature branch that replicates unexpected behaviour.
current_allocation = (spot_price * last_securities_after_transaction) / current_valuation
Which are hardcoded?
last_securities_after_transaction is modified on the following line:
Spot_price and current_valuation also vary day to day.
Spot price varies day to day but in the case of the two calculations i mentioned last_securities_after_transaction and last_cash_after_trade are not changed at any point following up to them, resulting in current_allocation and current_valuation constantly having the same outcome
are not changed at any point following up to them, resulting in current_allocation and current_valuation constantly having the same outcome
last_securities_after_transaction is changed in line 232.
This whole statement is in a loop, so when it is changed on line 232 it will change the next value calculated on line 135.
I found a couple values that are calculated using hard coded values of 0 and 1 where after the calculation checks for the result are unusable since the equation will always give the same result.
For example:
current_valuation = spot_price * last_securities_after_transaction + last_cash_after_trade
In this instance last_securities_after_transaction = 0 and last_cash_after trade = 1
The result of the calculation will always be 1.
I'm not sure if this is a mistake in the formula used or if last_cash_after_trade and last_securities_after_transaction should be set to different values.
The same issue can be seen with current_allocation:
current_allocation = (spot_price * last_securities_after_transaction) / current_valuation