我想使用load.instruments
包中的FinancialInstrument
来从csv文件中的元数据创建多个工具。
我的名为roots_test.csv
的csv文件看起来像
primary_id,description,type,exchange,currency,multiplier,initialmargin,identifiers
AD,Australian Dollar-CME(Floor+Electronic Combined),future,GLOBEX,USD,100000.00,5400,AUD
现在,如果我致电load.instruments
,它会正确加载数据,我可以使用AD
和AUD
获取工具。
但是现在说我想为同一个工具指定另一个标识符AD2
,该怎么做?
> load.instruments(file = 'roots_test.csv', default_type="future")
Warning messages:
1: In read.table(file = file, header = header, sep = sep, quote = quote, :
incomplete final line found by readTableHeader on 'roots_test.csv'
2: In future(primary_id = "AD", description = "Australian Dollar-CME(Floor+Electronic Combined)", :
underlying_id should only be NULL for cash-settled futures
3: In instrument(primary_id = primary_id, currency = currency, multiplier = multiplier, :
identifiersAUDdo not appear to be a named list
> getInstrument("AD")
primary_id :"AD"
currency :"USD"
multiplier :1e+05
tick_size : NULL
identifiers :List of 1
..$ :"AUD"
type :"future"
description :"Australian Dollar-CME(Floor+Electronic Combined)"
exchange :"GLOBEX"
initialmargin:5400
underlying_id: NULL
> getInstrument("AUD")
primary_id :"AD"
currency :"USD"
multiplier :1e+05
tick_size : NULL
identifiers :List of 1
..$ :"AUD"
type :"future"
description :"Australian Dollar-CME(Floor+Electronic Combined)"
exchange :"GLOBEX"
initialmargin:5400
underlying_id: NULL