SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Wed Oct 21, 2020 12:05 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Oct 29, 2019 1:13 pm 
Offline

Joined: Mon Aug 05, 2019 7:11 pm
Posts: 15
I can doing this in provider side:
Code:
base.EmitExecutionReport(executionReport); // user order filled report


And trigger callback function in strategy side:
Code:
   protected override void OnPositionChanged(Position position)
   {
      //.....
   }


But what if I want to emit position data by myself? I try this but failed:
Code:
     Position pos = new Position(....); // the real position I received from the bitcoin exchange api
     base.EmitData(pos);//error: pos is not a DataObject object


Or a simpler question(for not only position but more information): How to emit a double value from provider to strategy?


Top
 Profile  
 
PostPosted: Tue Oct 29, 2019 2:03 pm 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 578
dave10030 wrote:
But what if I want to emit position data by myself? I try this but failed:
Code:
     Position pos = new Position(....); // the real position I received from the bitcoin exchange api
     base.EmitData(pos);//error: pos is not a DataObject object


Hi,
you cannot do this.
We have special type of strategy called FXStrategy, which is inherited from InstrumentStrategy.
Details: http://www.smartquant.com/forums/viewtopic.php?f=86&t=14801&p=41019&hilit=FXStrategy#p41019


Top
 Profile  
 
PostPosted: Tue Oct 29, 2019 2:04 pm 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 578
dave10030 wrote:
Or a simpler question(for not only position but more information): How to emit a double value from provider to strategy?

Double value for what?


Top
 Profile  
 
PostPosted: Tue Oct 29, 2019 2:35 pm 
Offline

Joined: Mon Aug 05, 2019 7:11 pm
Posts: 15
skuvv wrote:
dave10030 wrote:
Or a simpler question(for not only position but more information): How to emit a double value from provider to strategy?

Double value for what?



I can not only receive market data from the exchange api, but also some parameters like delta,gamma,rho or my current profit&loss or ....., I want to know how to emit these values to my strategy.


Top
 Profile  
 
PostPosted: Tue Oct 29, 2019 3:04 pm 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 578
Best way to send information from broker is use Account Data, examples for strategy:
Code:
        private void GetAccountData(byte providerId)
        {
            AccountDataSnapshot data = this.framework.AccountDataManager.GetSnapshot(providerId, providerId);

            if (data != null && data.Entries.Length != 0)
            {
                Console.WriteLine("AccountDataSnapshot, records count " + data.Entries.Length);

                foreach (AccountDataEntry entry in data.Entries)
                {
                    Console.WriteLine("Account:" + entry.Account);
                    Console.WriteLine("Values Fields Count :" + entry.Values.Fields.Count);
                    Console.WriteLine("Positions Length:" + entry.Positions.Length);
                    Console.WriteLine("Orders Length:" + entry.Orders.Length);
                }
            }
            else
                Console.WriteLine("AccountDataSnapshot no data");
        }

      protected override void OnAccountData(SmartQuant.AccountData accountData)
      {
         string msg = "OnAccountData at "+Instrument+" Account: "+accountData.Account+" fieldsCount: "+ accountData.Fields.Count;
         
         foreach(AccountDataField field in accountData.Fields)
            msg += " "+field.Name+" "+field.Value;
         
         Console.WriteLine(msg);
      }


for provider side:
Code:
         AccountData data = new AccountData(framework.Clock.DateTime, AccountDataType.Position, accountName, this.id, this.id); // or AccountDataType.AccountValue

         data.Fields.Add(fieldName, currency, fieldValue);

         EmitAccountData(data);


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 1 guest


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:  
Powered by phpBB® Forum Software © phpBB Group