You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/userguide.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -319,7 +319,7 @@ Can also be referenced like so: `systems.futures.rules.ewmac`
319
319
320
320
Also note that the list of data for the rule will also be in the form of string references to methods in the system object. So for example to get the daily price we'd use the method `system.rawdata.daily_prices(instrument_code)` (for a list of all the data methods in a system see [stage methods](#table_system_stage_methods) or type `system.rawdata.methods()` and `system.rawdata.methods()). In the trading rule specification this would be shown as "rawdata.daily_prices".
321
321
322
-
If no data is included, then the system will default to passing a single data item - the price of the instrument. Finally ifanyorall the `other_arg` keyword arguments are missing then the function will use it's own defaults.
322
+
If no data is included, then the system will default to passing a single data item - the price of the instrument. Finally ifanyorall the `other_arg` keyword arguments are missing then the function will use its own defaults.
323
323
324
324
At this stage we can also remove any trading rules that we don't want. We also ought to modify the forecast scalars (See [forecast scale estimation](#scalar_estimate]), forecast weights and probably the forecast diversification multiplier ( see [estimating the forecast diversification multiplier](#divmult)). If you're estimating weights and scalars (i.e. in the pre-baked estimated futures system provided) this will be automatic.
325
325
@@ -1074,7 +1074,7 @@ Warning: Be careful about changing a system from estimated to non estimated 'on
1074
1074
1075
1075
### Using the system object
1076
1076
1077
-
The system object doesn't do very much in itself, except provide access to it's'child' stages, and a limited number of methods. The child stages are all attributes of the parent system.
1077
+
The system object doesn't do very much in itself, except provide access to its'child' stages, and a limited number of methods. The child stages are all attributes of the parent system.
1078
1078
1079
1079
#### Accessing child stages, data, and config within a system
1080
1080
@@ -1507,7 +1507,7 @@ For reference here is [`calc_or_cache_nested`](/systems/basesystem.py). Notice t
1507
1507
If itemname[instrument_code][keyname] exists return it.
1508
1508
Else call func with arguments: self, instrument_code, keyname, *args
1509
1509
and **kwargs if we have to call the func updates the dictionary with
1510
-
it's value
1510
+
its value
1511
1511
1512
1512
Used for cache within various kinds of objects like config, price,
1513
1513
data, system...
@@ -1779,7 +1779,7 @@ This approach (which you can also think of as the stage "API") is used to make i
1779
1779
1780
1780
### Using a different set of stages
1781
1781
1782
-
There are different versions of certain stages available; for example we can use either `ForecastScaleCapFixed`or`ForecastScaleCapEstimated`. Additionally you can add new kinds of stages if desired (see below), and remove stages you don't need (though you can't remove intermediate stages that a remaining stage would need to work out it's results).
1782
+
There are different versions of certain stages available; for example we can use either `ForecastScaleCapFixed`or`ForecastScaleCapEstimated`. Additionally you can add new kinds of stages if desired (see below), and remove stages you don't need (though you can't remove intermediate stages that a remaining stage would need to work out its results).
1783
1783
1784
1784
It's best to create a new 'pre-baked' system by copying and modifying a file such as [this](/systems/provided/futures_chapter_15/basesystem.py). You need to import the new stages you require and then put them into the system, like so:
1785
1785
@@ -1812,7 +1812,7 @@ If you're going to write a new stage (completely new, or to replace an existing
1812
1812
5. Consider using a [*switching*](#switch_persistence) stage like [class `ForecastCombine`](/systems/forecast_combine.py) (there are similar switches for forecast scaling and portfolios).
1813
1813
6. Think about whether you need to protect part of the system cache for this stage output [system caching](#caching). To do this create a list in the attribute `_protected` with the item names you wish to protect.
1814
1814
6a. Similarly if you're going to cache complex objects that won't pickle easily (like accountCurve objects) you need to add the item name to the attribute '_nopickle'.
1815
-
7. If you're inheriting from another stage be sure to add to it'slist of protected items, rather than replacing it.
1815
+
7. If you're inheriting from another stage be sure to add to its list of protected items, rather than replacing it.
1816
1816
8. Use non-cached input methods to get data from other stages. Be wary of accessing internal methods in other stages; try to stick to output methods only.
1817
1817
9. Use cached input methods to get data from the system data object (since this is the first time it will be cached). Again only access public methods of the system data object.
1818
1818
10. Use cached methods for internal and output methods(see [system caching](#caching) ). Cache keys for items should be the same as the method name.
@@ -2514,7 +2514,7 @@ from systems.forecasting import TradingRule
2514
2514
2515
2515
system=futures_system()
2516
2516
2517
-
## Parse the existing rules in the config (not required if you're going to backtest first as this will call this method doing it's normal business)
2517
+
## Parse the existing rules in the config (not required if you're going to backtest first as this will call this method doing its normal business)
2518
2518
system.rules.trading_rules()
2519
2519
2520
2520
@@ -3142,7 +3142,7 @@ Weighting for trading rules p&l is a *little* complicated.
3142
3142
3143
3143
*`pandl_for_trading_rule`:* If I want the performance of a given trading rule across individual instruments in isolation, then I need to take `pandl_for_trading_rule_weighted`and normalise it so that the returns are as a proportion of the sum of all the relevant forecast weight *FDM* instrument weight *IDM; this is equivalent to the rules risk contribution within the system. . This is an unweighted curve in one sense (it's not a proportion of total capital), but it's weighted in another (the indiviaul curves when added up give the group curve). The total account curve will have the same target risk as the entire system. The individual curves within it are for each instrument, weighted by their contribution to risk.
3144
3144
3145
-
*`pandl_for_all_trading_rules_unweighted`:* If I group *these* curves together, then I get `pandl_for_all_trading_rules_unweighted`. The individual curves will be individual trading rules but not weighted; so each will have it's own risk target. This is an unweighted group in the truest sense; the total curve won't make sense.
3145
+
*`pandl_for_all_trading_rules_unweighted`:* If I group *these* curves together, then I get `pandl_for_all_trading_rules_unweighted`. The individual curves will be individual trading rules but not weighted; so each will have its own risk target. This is an unweighted group in the truest sense; the total curve won't make sense.
3146
3146
3147
3147
3148
3148
To summarise:
@@ -3249,16 +3249,16 @@ As you can see the log is also currently used for very basic error handling.
3249
3249
3250
3250
### Advanced logging
3251
3251
3252
-
In my experience wading through long log files is a rather time consuming experience. On the other hand it's ofen more useful to use a logging approach to monitor system behaviour than to try and create quantitative diagnostics. For this reason I'm a big fan of logging with*attributes*. Every time a log method is called, it will typically know one or more of the following:
3252
+
In my experience wading through long log files is a rather time consuming experience. On the other hand it's often more useful to use a logging approach to monitor system behaviour than to try and create quantitative diagnostics. For this reason I'm a big fan of logging with*attributes*. Every time a log method is called, it will typically know one or more of the following:
3253
3253
3254
-
- which 'type' of process owns the logger. For example if it's part of a base_system object, it'stype will be 'base_system'. Future types will probably include price collection, execution and so on.
3254
+
- which 'type' of process owns the logger. For example if it's part of a base_system object, its type will be 'base_system'. Future types will probably include price collection, execution and so on.
3255
3255
- which 'stage'or sub process is involved, such as'rawdata'.
3256
3256
- which instrument code is involved
3257
3257
- which trading rule variation is involved
3258
3258
- which specific futures contract we're looking at (for the future)
3259
3259
- which order id (for the future)
3260
3260
3261
-
Then we'll be able to save the log message with it's attributes in a database (in future). We can then query the database to get, for example, all the log activity relating to a particular instrument code or trade, for particular dates.
3261
+
Then we'll be able to save the log message with its attributes in a database (in future). We can then query the database to get, for example, all the log activity relating to a particular instrument code or trade, for particular dates.
3262
3262
3263
3263
You do need to keep track of what attributes your logger has. Generally speaking you should use this kind of pattern to write a log item
0 commit comments