SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Thu Aug 16, 2018 9:34 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: OpenQuant3.9 bug report
PostPosted: Sun Sep 29, 2013 2:55 am 
Offline

Joined: Mon Nov 12, 2012 2:38 am
Posts: 59
Please refer to following code, it works in OpenQuant3.8, but crashed in 3.9
After I change my Instrument's Currency from CNY to USD, it works

using System;
using System.Drawing;

using OpenQuant.API;
using OpenQuant.API.Indicators;

public class MyStrategy : Strategy
{
public override void OnStrategyStart()
{
}

public override void OnBar(Bar bar)
{
if (Bars.Count == 3)
{ // here it goes crashed!!!!
Portfolio.Add(bar.DateTime, OpenQuant.API.TransactionSide.Buy, 1, Instrument, bar.Close, "playback");
}
}
}




the info attached:
--------------------------------------------------
System.NullReferenceException: Object reference not set to an instance of an object.
at SmartQuant.Instruments.AccountPositionList.get_Item(Currency currency)
at SmartQuant.Instruments.Account.Add(AccountTransaction transaction)
at SmartQuant.Instruments.Account.Add(Double val, Currency currency, DateTime dateTime, String text)
at SmartQuant.Instruments.Portfolio.Add(Transaction transaction)
at OpenQuant.Runner.Portfolio_TransactionAdded(Object sender, TransactionEventArgs args)
at SmartQuant.Instruments.Portfolio.F1v18r4s8O(Transaction )
at SmartQuant.Instruments.Portfolio.Add(Transaction transaction)
at OpenQuant.Trading.SolutionRunner.Portfolio_TransactionAdded(Object sender, TransactionEventArgs args)
at SmartQuant.Instruments.TransactionEventHandler.Invoke(Object sender, TransactionEventArgs args)
at SmartQuant.Instruments.Portfolio.F1v18r4s8O(Transaction )
at SmartQuant.Instruments.Portfolio.Add(Transaction transaction)
at OpenQuant.API.Portfolio.Add(DateTime datetime, TransactionSide side, Double qty, Instrument instrument, Double price, String text)
at MyStrategy.OnBar(Bar bar) in d:\Users\Administrator\Documents\OpenQuant\Projects\TestCase7\code.cs:line 17
at OpenQuant.Trading.StrategyRunner.OnNewBar(Instrument instrument, Bar bar)
at OpenQuant.Trading.StrategyRunner.SetNewBarSlice(Int64 barSize)


Top
 Profile  
 
PostPosted: Tue Aug 26, 2014 8:32 am 
Offline

Joined: Mon Nov 12, 2012 2:38 am
Posts: 59
Hello SmartQuant experts,
I dont know, in your view, the above issue is considered as an error or it is just my wrong understanding? If I am using it in wrong way, how to do it correctly?

Thanks!


Top
 Profile  
 
PostPosted: Tue Aug 26, 2014 10:40 am 
Offline

Joined: Mon Aug 01, 2011 9:31 am
Posts: 62
Hi, gzadigo.

Thanks for your message.
Unfortunately, OpenQuant doesn't have predefined currency code "CNY". It's the reason of exception.
We'll fix this issue in next release. Until this moment, you could use one of the predefined codes, for example "USD".

_________________
SmartQuant Development Team


Top
 Profile  
 
PostPosted: Tue Sep 09, 2014 5:38 am 
Offline

Joined: Mon Nov 12, 2012 2:38 am
Posts: 59
Thanks! I tested version 3.13.0, it works! seems you already have CNY currency code there


Top
 Profile  
 
PostPosted: Tue Sep 09, 2014 7:28 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6808
Yes, we've added all ISO currencies.

Regards,
Anton


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group