A single strategy class may produce multiple instances of strategies that trade different contracts or use different parameters.

{
  "Name": "MoMacd ETHUSDT",
  "ClassName": "QuantInfra.Strategies.Examples.MoMacdExample",
  "RequiredBarStorages": {
    "main": {
      "IdType": "Contract",
      "Id": 20614,
      "AggregationType": "Time",
      "TradingSessionIds": null,
      "Timeframe": "PT15M",
      "Offset": "P0D",
      "Timezone": "UTC",
      "LastValueOnly": false
    }
  },
  "Symbols": {
    "main": 20614
  },
  "Params": "{ \\u0022coefficient\\u0022: \\u00221\\u0022, \\u0022downFractalPeriod\\u0022: \\u00222\\u0022, \\u0022maxDivide\\u0022: \\u00221\\u0022, \\u0022tp\\u0022: \\u00220.01\\u0022, \\u0022upFractalPeriod\\u0022: \\u00222\\u0022, \\u0022mmType\\u0022: \\u0022FixMoneyManagement\\u0022 }",
  "Account": {
        "Name": "MoMacd ETHUSDT VA",
        "AccountType": "VirtualAccount",
        "CurrencyId": 840,
        "PositionAccounting": "Hedged",
        "EnableSharePriceTracking": true
    },
    "StartImmediately": true
}

Parameters

Field Type Description
Name string Arbitrary name of the strategy
Class name string Full name (including namespace) of the class the implements the strategy
Symbols Dictionary<string, int> IDs of the contracts traded by the strategy.

Keys of the dictionary serve as internal names for the contracts. If you run a strategy on different contracts, its internal logic won’t change:

Strategy code: OpenPosition(”main”, 10, Side.Buy)

Strategy 1 config: Symbols: { “main”: 12345 // BTCUSD } Strategy 2 config: Symbols: { “main”: 54321 // AAPL } | | Required bar storages | Dictionary<string, BarStorageConfig> | Candles used by the strategy.

Keys of the dictionary serve as internal names for the candles (the same logic as for Symbols) | | Params | string | A JSON string containing the set of strategy parameters. \u0022 or \” can be used as escape for the quote symbol. | | Account | Account Configuration | |

Bar storage (candles) configuration

Field Type Description
IdType enum
Contract
Stream Denotes whether the ID refers to a contract or to a stream
Id int ID of the used contract or stream.
Aggregation type Time Currently, only time aggregation is supported
Trading session IDs int[] If provided, will denote that candles or ticks only from these trading sessions will be used
Timeframe Nodatime.Period Timeframe of the candles.
The only limitations to timeframes are:
• No longer than 24 hours
• 24 hours must be divisible by the timeframe length
Offset Nodatime.Period Candles can be closed with some offset, e.g. 1 hour timeframe with candles closing at the 5th minute of each hour
Timezone string Use NodaTime.DateTimeZoneProviders.Tzdb

By default, the exchange time zone of the contract is used.

Use only with the daily timeframe and when using multiple contracts with different time zones. | | Last value only | bool | Indicates that only the close price of the last bar is required when hydrating the historical candles upon deploying the strategy. |

Account configuration

Field Type Description
Name string Optional, defaults to $”{Strategy Name} {Account Type}”
Account type VirtualAccount
StrategySubaccount For backtesting, always use VirtualAccount.
For live execution, the choice depends on the execution mode.
Currency ID int The ID of the account’s base currency
Position Accounting Netted
Hedged Hedged accounting allows to track several positions for the same contract independently.
Enable share price tracking bool Denotes if you want to track percentage returns for the account (normally, must be enabled for strategy accounts)