How do I import the MarketRisk HistSimVar example market data and fixings?
Reproduce, from the command line, a larger market data import
against the MarketRisk/HistSimVar ORE example — a good full-workflow
example since it has a real, non-empty fixings.txt alongside its
market.txt. The ores-shell block below is tangled into the
runnable script library as import_marketrisk_histsimvar.ores.
Question
How do I import the MarketRisk HistSimVar example's market data and fixings from the shell?
Answer
The marketdata import command
(projects/ores.shell/src/app/commands/marketdata_commands.cpp)
sends both file contents as a single import_market_data_request
over NATS (subject marketdata.v1.import), the same request the Qt
ImportTradeDialog sends — reusing import_service as-is, no
server-side code specific to the shell.
Expectations: the services are up (compass services start), a
tenant/party is provisioned and logged in (e.g. via the Acme Corporation
provisioning recipe), and --source tags every imported row so it
can be queried back out separately from other imports.
marketdata import --file external/ore/examples/MarketRisk/Input/HistSimVar/market.txt --fixings external/ore/examples/MarketRisk/Input/HistSimVar/fixings.txt --source ore.reference logout
Run it from a connected, logged-in shell, or load the generated
script. File paths are relative to the repo root — compass shell -f
<script> always runs ores.shell with the repo root as its working
directory, so no absolute path or project-root environment variable
is needed:
./ores.shell ${log_args} ${connect_args} ${login_args} << 'EOF'
<<import-marketrisk-histsimvar>>
EOF
> marketdata import --file external/ore/examples/MarketRisk/Input/HistSimVar/market.txt --fixings external/ore/examples/MarketRisk/Input/HistSimVar/fixings.txt --source ore.reference Importing market data... ✓ Imported 217 series, 7172 observation(s), 904 fixing(s): > logout ✓ Logged out successfully.
This vintage's fixings.txt has 904 real rows, confirmed imported
correctly — good evidence that fixings import itself works, unlike
How do I import the 2016-02-05 ORE reference vintage market data?,
whose failure is specific to that file's market.txt series
decomposition.
Script
projects/ores.shell/scripts/library/marketdata/import_marketrisk_histsimvar.ores
— generated from this recipe's ores-shell block by compass build
--direct tangle_shell_scripts (do not edit the .ores by hand).
Tested by
Manual: run against a freshly recreated, Acme-provisioned
database (compass db recreate -y -k then the Acme Corporation provisioning
recipe), then compass shell -u <user> -p <password> -f
import_marketrisk_histsimvar.ores.