How do I run the swap_legs commands from the shell?
Table of Contents
This file documents the swap_legs resource at the shell, one section per command. Every command is a subcommand of swap_legs, and every section exports its own script into projects/ores.shell/scripts/library/. Loading a script runs that one command, so a failure names the command it came from.
1. Commands
1.1. list
Reads one page of the collection. Nothing addresses it but the caller's tenant, so it is the read that shows what exists.
The command is shaped like this:
swap_legs list [--offset <n>] [--limit <n>] [--order <field>] [--desc]
It is addressed at trading.v1.swap_legs.list.
swap_legs list --limit 1
1.2. get
Reads the one row its key addresses. A key states every identifying column, so a partial key is refused rather than answered with an arbitrary row.
The command is shaped like this:
swap_legs get <trade_id> <leg_number>
It is addressed at trading.v1.swap_legs.get.
swap_legs get 00000000-0000-0000-0000-000000000000 0
1.3. get-many
Reads several rows in one request, one key group per row.
The command is shaped like this:
swap_legs get-many <trade_id> <leg_number>
It is addressed at trading.v1.swap_legs.get_many.
swap_legs get-many 00000000-0000-0000-0000-000000000000 0
1.4. add
Writes a row. The change states that the row must not exist, so a create that collides with an existing row is refused rather than replacing it. The change carries a reason and a commentary, which the server records on it so the row's history says why it moved.
The command is shaped like this:
swap_legs add <leg_number> <trade_activity_id> <payer> <leg_type_code> <day_count_fraction_code> <business_day_convention_code> <payment_frequency_code> <floating_index_code> <currency> <leg_group> <fixing_days> <is_in_arrears> <include_spread> <is_averaged> <has_sub_periods> <notional_initial_exchange> <notional_final_exchange> <payment_lag> <payment_calendar> <commodity_price_type> <future_month_offset> <daily_expiry_offset> <pricing_calendar> <equity_return_type> <equity_name> <equity_underlying_type> <equity_underlying_identifier_type> <equity_quantity> <equity_initial_price> <equity_initial_price_currency> <equity_dividend_factor> <equity_notional_reset> <equity_currency> <fx_index> <fx_reset_foreign_currency> <fx_reset_start_date> <fx_reset_foreign_amount> <fx_reset_fx_index> <fx_reset_fixing_days> <fx_reset_fixing_calendar> <fixing_calendar> <digital_call_position> <digital_is_call_atm_included> <digital_put_position> <digital_is_put_atm_included> <equity_margin_initial_margin_factor> <equity_margin_multiplier> <commodity_pay_relative_to> <commodity_quantity_frequency> <pricing_date_rule> <indexings_from_asset_leg> <floating_index_code_2> <cms_duration> <naked_option> <lookback> <rate_cutoff> <local_cap_floor> <observation_lag> <cpi_base> <cpi_start_date> <cpi_interpolation> <cpi_interpolated> <subtract_inflation_notional> <zero_coupon_compounding> <zero_coupon_subtract_notional> <reason> <commentary>
It is addressed at trading.v1.swap_legs.put.
swap_legs add 0 00000000-0000-0000-0000-000000000000 - __none__ __none__ __none__ __none__ __none__ __none__ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - system.new_record generated_script
1.5. set
Writes a row. The change states no precondition, so it replaces whatever row the key already addresses. The change carries a reason and a commentary, which the server records on it so the row's history says why it moved. Passing –version makes the write conditional on the version the caller last read.
The command is shaped like this:
swap_legs set <trade_id> <leg_number> <trade_activity_id> <payer> <leg_type_code> <day_count_fraction_code> <business_day_convention_code> <payment_frequency_code> <floating_index_code> <currency> <leg_group> <fixing_days> <is_in_arrears> <include_spread> <is_averaged> <has_sub_periods> <notional_initial_exchange> <notional_final_exchange> <payment_lag> <payment_calendar> <commodity_price_type> <future_month_offset> <daily_expiry_offset> <pricing_calendar> <equity_return_type> <equity_name> <equity_underlying_type> <equity_underlying_identifier_type> <equity_quantity> <equity_initial_price> <equity_initial_price_currency> <equity_dividend_factor> <equity_notional_reset> <equity_currency> <fx_index> <fx_reset_foreign_currency> <fx_reset_start_date> <fx_reset_foreign_amount> <fx_reset_fx_index> <fx_reset_fixing_days> <fx_reset_fixing_calendar> <fixing_calendar> <digital_call_position> <digital_is_call_atm_included> <digital_put_position> <digital_is_put_atm_included> <equity_margin_initial_margin_factor> <equity_margin_multiplier> <commodity_pay_relative_to> <commodity_quantity_frequency> <pricing_date_rule> <indexings_from_asset_leg> <floating_index_code_2> <cms_duration> <naked_option> <lookback> <rate_cutoff> <local_cap_floor> <observation_lag> <cpi_base> <cpi_start_date> <cpi_interpolation> <cpi_interpolated> <subtract_inflation_notional> <zero_coupon_compounding> <zero_coupon_subtract_notional> <reason> <commentary> [--version <n>]
It is addressed at trading.v1.swap_legs.put.
swap_legs set 00000000-0000-0000-0000-000000000000 0 00000000-0000-0000-0000-000000000000 - __none__ __none__ __none__ __none__ __none__ __none__ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - system.new_record generated_script
1.6. put-many
Writes several rows in one request. The count states how many field groups follow. The change carries a reason and a commentary, which the server records on it so the row's history says why it moved.
The command is shaped like this:
swap_legs put-many --count <n> <trade_id> <leg_number> <trade_activity_id> <payer> <leg_type_code> <day_count_fraction_code> <business_day_convention_code> <payment_frequency_code> <floating_index_code> <currency> <leg_group> <fixing_days> <is_in_arrears> <include_spread> <is_averaged> <has_sub_periods> <notional_initial_exchange> <notional_final_exchange> <payment_lag> <payment_calendar> <commodity_price_type> <future_month_offset> <daily_expiry_offset> <pricing_calendar> <equity_return_type> <equity_name> <equity_underlying_type> <equity_underlying_identifier_type> <equity_quantity> <equity_initial_price> <equity_initial_price_currency> <equity_dividend_factor> <equity_notional_reset> <equity_currency> <fx_index> <fx_reset_foreign_currency> <fx_reset_start_date> <fx_reset_foreign_amount> <fx_reset_fx_index> <fx_reset_fixing_days> <fx_reset_fixing_calendar> <fixing_calendar> <digital_call_position> <digital_is_call_atm_included> <digital_put_position> <digital_is_put_atm_included> <equity_margin_initial_margin_factor> <equity_margin_multiplier> <commodity_pay_relative_to> <commodity_quantity_frequency> <pricing_date_rule> <indexings_from_asset_leg> <floating_index_code_2> <cms_duration> <naked_option> <lookback> <rate_cutoff> <local_cap_floor> <observation_lag> <cpi_base> <cpi_start_date> <cpi_interpolation> <cpi_interpolated> <subtract_inflation_notional> <zero_coupon_compounding> <zero_coupon_subtract_notional> <reason> <commentary>
It is addressed at trading.v1.swap_legs.put_many.
swap_legs put-many --count 1 00000000-0000-0000-0000-000000000000 0 00000000-0000-0000-0000-000000000000 - __none__ __none__ __none__ __none__ __none__ __none__ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - system.new_record generated_script
1.7. delete
Removes a row. The change carries a reason and a commentary, which the server records on it so the row's history says why it moved. Passing –version makes the write conditional on the version the caller last read.
The command is shaped like this:
swap_legs delete <trade_id> <leg_number> <reason> <commentary> [--version <n>]
It is addressed at trading.v1.swap_legs.delete.
swap_legs delete 00000000-0000-0000-0000-000000000000 0 system.new_record generated_script
1.8. delete-many
Removes several rows in one request. The change carries a reason and a commentary, which the server records on it so the row's history says why it moved.
The command is shaped like this:
swap_legs delete-many <trade_id> <leg_number> <reason> <commentary>
It is addressed at trading.v1.swap_legs.delete_many.
swap_legs delete-many 00000000-0000-0000-0000-000000000000 0 system.new_record generated_script
1.9. by-trade-id
Reads one page of the rows that share a relation value. The relation is part of the address rather than a filter applied after the read.
The command is shaped like this:
swap_legs by-trade-id <trade_id> [--offset <n>] [--limit <n>] [--order <field>] [--desc]
It is addressed at trading.v1.swap_legs.list_by_trade_id.
swap_legs by-trade-id 00000000-0000-0000-0000-000000000000 --limit 1
1.10. versions
Reads the row's recorded history, newest first.
The command is shaped like this:
swap_legs versions <trade_id> <leg_number> [--offset <n>] [--limit <n>] [--order <field>] [--desc]
It is addressed at trading.v1.swap_legs_versions.list.
swap_legs versions 00000000-0000-0000-0000-000000000000 0 --limit 1
1.11. version
Reads one recorded version of the row.
The command is shaped like this:
swap_legs version <trade_id> <leg_number> --version <n>
It is addressed at trading.v1.swap_legs_versions.get.
swap_legs version 00000000-0000-0000-0000-000000000000 0 --version 1