Write a script in Python 3, similar to read_mt_formats.py which instead of reading, it's modifying existing values, adds new records, or removes.
Suggested script filename: modify_mt_format.py (or similar)
The format is already defined in SymbolsRaw class in bstruct_defs.py which can be reused.
The feature should include:
adding new symbol group into file based on the given name and the name to copy values from
removing symbol group from the file based on the given name
modifying selected existing known values such as: description, altName, baseCurrency, digits, spread, profitCalcMode, contractSize, stopsLevel, marginInit, marginMaintenance, marginHedged, marginDivider, pointSize, pointsPerUnit, marginCurrency (ideally lookup for the available key names from SymbolsRaw._fields
Suggested input parameters:
-f (file) - input file name (mandatory)
-t (type)/--input-type - mandatory input file type (currently only symbolsraw)
-k (key) - key group name to use
-d - delete symbol name (specified by -k param) from the file (specified by -f)
-a (symbol-name) - add new symbol-name group with values copied from the symbol specified by -k, e.g. -a XAGUSD -k GOLD - create a new XAGUSD group with the same values as GOLD; if no -k is specified - create empty one (zero all values); if symbol already exists, do not add, display warning and exit with code 1
-m name=value - modify value of param key (name) with the given value, e.g. -k EURUSD -m digits=5; add support to modify multiple name/values at the same run (e.g. multiple -m, or separated by comma); -k is required for -m;
Write a script in Python 3, similar to
read_mt_formats.py
which instead of reading, it's modifying existing values, adds new records, or removes. Suggested script filename:modify_mt_format.py
(or similar)The format is already defined in
SymbolsRaw
class inbstruct_defs.py
which can be reused.The feature should include:
SymbolsRaw._fields
Suggested input parameters:
-f (file)
- input file name (mandatory)-t (type)
/--input-type
- mandatory input file type (currently onlysymbolsraw
)-k (key)
- key group name to use-d
- delete symbol name (specified by-k
param) from the file (specified by-f
)-a (symbol-name)
- add new symbol-name group with values copied from the symbol specified by-k
, e.g.-a XAGUSD -k GOLD
- create a new XAGUSD group with the same values as GOLD; if no-k
is specified - create empty one (zero all values); if symbol already exists, do not add, display warning and exit with code 1-m name=value
- modify value of param key (name) with the given value, e.g.-k EURUSD -m digits=5
; add support to modify multiple name/values at the same run (e.g. multiple-m
, or separated by comma);-k
is required for-m
;Related: #41
symbols.raw.zip symbols.raw-samples.zip