The AWTS command line utility serves to aid configuration and management of your environment. Use it to inspect running services, export data for offline analysis, discover/manage running services and pretty much everything else.
See the installation instructions for how to install the AWTS CLI tool.
The CLI tool can also be part of a wider toolchain, in line with the UNIX philosophy of using many small tools that interconnect - e.g. use a command like awts streamcandles POLYGON:AAPL --resolution 60 --format json
to stream candles for AAPL in JSON format to stdout
for piping into another tool or script.
Run the tool without any arguments, or with --help
for usage information. E.g.:
AWTS CLI interface - Command line tool for interacting with AWTS environments
Usage:
awts [command]
Available Commands:
admin Administrative outputs, including license status/details
book Interact with books (see subcommands)
candles A shorthand for 'data candles', retrieve candles for an instrument
chart Push a chart to a dash widget
completion Generate the autocompletion script for the specified shell
config Dump config info
dash Interact with dashboards
data Interact with market data (candles, streaming, price)
debug Debug/test operations
help Help about any command
mux Show mux status info, including registered modules
muxstream Stream mux status info, including registered modules, repeating output when updated
news Administer/view news feeds
results Interact with results (see subcommands)
runner Set & manage jobs/strategies/alerts
strat Interact with strategy manager service
stratworker Interact with strategies directly
wapp Interact with the hosted web app (alphaweighted.com)
Flags:
--config string Config file - default config.yaml
--format string omit for human, or set csv|tsv|md|html
-h, --help help for cli
--mux string Mux service DSN
--timezone string Timezone for date handling, defaults to OS default
-v, --verbosity string Verbosity = error|warn|info|debug (default "error")
Additional help topics:
cli calendar Administer/view calendar feeds
Use "cli [command] --help" for more information about a command.
Use the data
command and search
subcommand to search for an instrument by partial symbol or name:
❯ awts data search SPX
+------------------+------------+
| SYMBOL | NAME |
+------------------+------------+
| OANDA:SPX500_USD | US SPX 500 |
+------------------+------------+
❯ awts data value OANDA:SPX500_USD
+-----------------------+----------------------+
| At | 2023-12-22T10:49:32Z |
| Value last updated at | 2023-12-22T10:49:32Z |
| Value | 4751 |
| Bid | 4750.8 |
| Ask | 4751.2 |
+-----------------------+----------------------+
View or export candle data with the awts data candles <symbol>
command.
You must specify resolution
in the form H1
, D
, M5
, etc. Whilst not all data sources support all resolutions, all common resolutions are supported pretty much everywhere - e.g. --resolution=M5
.
Use --from
and --to
dates to time bound the export. Dates must be specified in ISO format and can be just dates or date+time (i.e. yyyy-mm-dd
or yyyy-mm-ddThh:mm:ss
).
By default the output is printed formatted to the console as shown below. You can use --format=csv
and pipe the output to a CSV file to produce export files for offline processing elsewhere.
❯ awts data candles OANDA:NAS100_USD --resolution=M15 --from=2023-12-01T00:00:00
Timestamp Vol O H L C Vwap Spread
2023-12-01T00:00:00Z 35 15931.40 15932.80 15926.80 15931.80 15930.70 1.90
2023-12-01T00:15:00Z 18 15930.80 15931.80 15928.60 15930.40 15930.40 1.90
2023-12-01T00:30:00Z 20 15929.20 15929.60 15925.60 15927.80 15928.05 1.90
2023-12-01T00:45:00Z 29 15926.80 15928.40 15924.20 15927.60 15926.75 1.90
2023-12-01T01:00:00Z 42 15926.80 15929.80 15922.40 15922.60 15925.40 1.90
...snip...
Note that VWAP and spread are included. Not all data sources provide spread, so values will be zero where not known. VWAP is always included but may be calculated differently by different data modules, see the VWAP docs for details.
Streaming behaves in a similar fashion to fetching candles, except that the start and end dates are optional.
If the start date is omitted, streaming will start from now. If the start date is specified, historic data will be streamed and will automatically continue into real-time data seamlessly.
If the end date is omitted, streaming will continue real time indefinitely. If the end date is in the future, streaming will automatically stop at that time.
You can specify both start and end dates in the past, and all records between those dates will be streamed. Sometimes this is just a more convenient way to retrieve large amounts of data (e.g. billions of rows).
The --format
argument is supported here, so that streamed data can be piped into a file or another script. E.g. to stream M15 data for the NAS100_USD
instrument to stdout
, all the way up to now and then onwards indefinitely, into a script (my_strategy
) that implements your strategy:
❯ awts data streamcandles OANDA:NAS100_USD --resolution=M15 --from=2024-01-01T00:00:00 --format=csv | ./my_strategy
Note: in situations like the above example, it is useful for the retrieving script to know when streaming of historic data is done and real-time data is about to happen. Flags to this effect are included in the underlying API responses, but are not included in the CLI tool outputs.
The CLI tool has commands/subcommands for interacting with all AWTS services/components and is self-documenting. Try experimenting with the various commands and use --help
for extra help/details as needed.