November 2019
Beginner
394 pages
10h 31m
English
This risk metric measures the traded volume, which can also have an interval-based variant that measures volume per period. This is another risk measure that is meant to detect and prevent overtrading. For example, some of the catastrophic software implementation bugs we discussed in this chapter could've been prevented if they had a tight volume limit in place that warned operators about risk violations and possibly a volume limit that shut down trading strategies. Let's observe the traded volume for our strategy, which is shown in the following code:
traded_volume = 0for i in range(0, num_days): if results['Trades'].iloc[i] != 0: traded_volume += abs(results['Position'].iloc[i] - results['Position'].iloc[i-1])print('Total ...