如何有计划地添加合约
The code below demonstrates how to write a simple script that adds new instruments to the instrument data base and application instrument list.
以下代码演示了如何通过编译一个简单脚本来把合约添加到合约数据库和应用合约列表。
This example can be found in the Script Explorer among other script samples.
这个例子能在脚本管理器的其他脚本示例中找到。
- using System;
- using OpenQuant.API;
- using OpenQuant.API.Indicators;
- public class MyScript : Script
- {
- public override void Run()
- {
- string[] symbols = new string[] {"Stock1", "Stock2", "Stock3"};
- foreach (string symbol in symbols)
- new Instrument(InstrumentType.Stock, symbol);
- }
- }