public void TestAgentCreationInvalidArguments() { List <String> Coins = new List <String> { "ETH", "BTC", "BCH", "NEO" }; TradingAgent agent = new TradingAgent(-100.0d, Coins); }
public void TestAgentCreationValidArguments() { List <String> Coins = new List <String> { "ETH", "BTC", "BCH", "NEO" }; TradingAgent agent = new TradingAgent(100.0d, Coins); Assert.NotNull(agent); }
public void TestKucoinClient() { List <String> coins = new List <String> { "ETH", "BTC", "BCH", "NEO" }; TradingAgent agent = new TradingAgent(100.0d, coins); KuCoinApi.NetCore.KuCoinApiClient kucoinClient = agent.GetKucoinClient(); Assert.NotNull(kucoinClient); }
public void TestBuyingPower() { List <String> Coins = new List <String> { "ETH", "BTC", "BCH", "NEO" }; double testBuyingPower = 100.0d; TradingAgent agent = new TradingAgent(testBuyingPower, Coins); List <String> agentCoins = agent.GetCoinTypes(); Assert.Equal(testBuyingPower, agent.GetBuyingPower()); }
public void TestDecideTransaction() { List <String> coins = new List <String> { "ETH", "BTC", "BCH", "NEO" }; TradingAgent agent = new TradingAgent(100.0d, coins); KuCoinApi.NetCore.KuCoinApiClient kucoinClient = agent.GetKucoinClient(); KuCoinApi.NetCore.Entities.Tick[] ticks = kucoinClient.GetTicks(); agent.GetCoinInfo(ticks, coins); agent.DecideTransaction(); // Buying power has changed due to buy transaction being carried out. Assert.NotEqual(100.0d, agent.GetBuyingPower()); }
public void TestAgentCoinsInput() { List <String> Coins = new List <String> { "ETH", "BTC", "BCH", "NEO" }; TradingAgent agent = new TradingAgent(100.0d, Coins); List <String> agentCoins = agent.GetCoinTypes(); Assert.NotEmpty(agentCoins); Coins = new List <String> { }; agent = new TradingAgent(100.0d, Coins); agentCoins = agent.GetCoinTypes(); Assert.Empty(agentCoins); }
private static PortfolioManager Get(string symbol) { //Initialize TradingPortfolio np = new TradingPortfolio(); //ADD INITIAL SECURITIES ForexSecurity security = new ForexSecurity(symbol); security.LotSize = 100000; //Lots security.PipSize = 0.0001M; //PipSize in 4 decimal places security.TickSize = 0.00001M; //Size of one tick security.PipValue = 1M; //PipValue, if unable to calculate to base currency security.Digits = 5; var account = new SimAccount("SIMULATED", "Sim account for backtesting", 10000, 100, "SIM"); np.SetAccount(account); np.Securities.AddSecurity(security); //ADD AGENT AND INJECT TEMPLATES np.InjectAgent <ExampleTradingAgent>(); //Set streams TradingAgent agent = (TradingAgent)np.Agents[0]; agent.AgentId = 115230; agent.TimeFrame = TimeSpan.FromSeconds(TimeFrameInSeconds); OHLCBarStream ls = new OHLCBarStream(np.Securities[symbol], np.Agents[0].TimeFrame); agent.SetDefaultStream(ls); ls.Initialize(); agent.Initialize(); agent.Start(); SimpleBacktester.OnMessage += SimpleBacktester_OnMessage; SimpleBacktester.OnProgress += SimpleBacktester_OnProgress; return(np); }