Connecting to different accounts with same API. Possible?

Questions about MultiCharts and user contributed studies.
wilkinsw
Posts: 662
Joined: 21 Apr 2013
Has thanked: 154 times
Been thanked: 104 times

Connecting to different accounts with same API. Possible?

Postby wilkinsw » 16 Jan 2015

Hi,

Using Patsystems as an example.

Is it possible to connect to account A broker A and account B broker B both using Patsystems? All from the one instance of Multicharts?

I can see that I can create two different Pats broker profiles. But I can't create two pats datafeeds, as the data source clone feature is for universal DDE only?? Is this right?

Many thanks!

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Connecting to different accounts with same API. Possible

Postby Dave Masalov » 16 Jan 2015

I can see that I can create two different Pats broker profiles. But I can't create two pats datafeeds, as the data source clone feature is for universal DDE only?? Is this right?
Hello wilkinsw,

You are absolutely correct. You can create two Pats broker profiles connected to different accounts at different brokers, but the data feed connection can be configured to one of the account at a time. So it is not possible to connect data from two Pats accounts at the same time. Though, two simultaneous broker connections are possible.

wilkinsw
Posts: 662
Joined: 21 Apr 2013
Has thanked: 154 times
Been thanked: 104 times

Re: Connecting to different accounts with same API. Possible

Postby wilkinsw » 16 Jan 2015

How about symbol mapping:

Can I have two charts both with the same IQfeed symbol but.....

Chart1: mapped to "Patsystems1 Broker A Symbol". e.g. "qcl#c" to "Phy crude-Feb15"

Chart2: mapped to "Patsystems2 Broker B Symbol". e.g. "qcl#c" to "Ph CRDE - FEB15"

Is this possible? Note that different brokers will use symbol names which vary to other brokers (if that makes a difference, as depicted here).

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Connecting to different accounts with same API. Possible

Postby Dave Masalov » 16 Jan 2015

The configuration that you described should work fine as long as Symbol Mapping is configured correctly.

wilkinsw
Posts: 662
Joined: 21 Apr 2013
Has thanked: 154 times
Been thanked: 104 times

Re: Connecting to different accounts with same API. Possible

Postby wilkinsw » 16 Jan 2015

So say symbol "Phy crude-Feb15" is from Patsystems1 which is also a connected data source. Say "Ph CRDE - FEB15" is the same instrument but on Patsystems2 which is NOT a connected data source.

Will firing orders to the broker's "Ph CRDE - FEB15" symbol generate any errors, if it's data is not connected?

Thanks!

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Connecting to different accounts with same API. Possible

Postby Henry MultiСharts » 23 Jan 2015

Hello wilkinsw,

There should be no issues with such setup.
If Asks and Bids are not provided for the connected broker (not related to data provider connection) then you need to set the Get Real-Time Data: from Chart.

wilkinsw
Posts: 662
Joined: 21 Apr 2013
Has thanked: 154 times
Been thanked: 104 times

Re: Connecting to different accounts with same API. Possible

Postby wilkinsw » 29 Jan 2015

Thanks Henry.

How about bottlenecks?

If I'm connected to two different Pats API accounts, does that mean all orders get queued through the one Pats plugin?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Connecting to different accounts with same API. Possible

Postby Henry MultiСharts » 03 Feb 2015

If I'm connected to two different Pats API accounts, does that mean all orders get queued through the one Pats plugin?
That is correct.

One trading plugin can process 1 order per time. It means all orders that are generated by the strategies are put into a queue and sent one by one to the API. Once one order is sent, the trading engine starts sending the next order. That is not technically possible to send two orders simultaneously to one API.
If there are two APIs (two different brokers) – then two orders can be sent almost at the same time.
In order to perform such high speed calculations you need a CPU with 4 cores or more.
Each chart with a strategy will get one flow.
Each trading instance will get one flow.
4 cores can get 1 flow each and supply parallel calculation.
But if you have a single broker profile then the amount of cores you have will not help to process the orders faster.

wilkinsw
Posts: 662
Joined: 21 Apr 2013
Has thanked: 154 times
Been thanked: 104 times

Re: Connecting to different accounts with same API. Possible

Postby wilkinsw » 03 Feb 2015

Ok Henry, I see what you're saying.

Technically then, two different brokers using the same order routing platforms (e.g. Patsystems in this case) each with their own different trade and price server IP addresses should make it technically possible to route in parallel, as they only share the name "Patsystems" in common and nothing else.

I guess the issue is needing to create a second plugin instance??

If this is technically possible, then let me know and I'll put in a request into project management. The need to create multiple plugin instances would also effect platforms like TT, Rithmic etc when connected to multiple brokers sharing the same routing platform.

On the other hand, I suppose an option is to rent another server and purchase another Multicharts license.

orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

Re: Connecting to different accounts with same API. Possible

Postby orion » 03 Feb 2015

Henry, I have some questions on this topic.
One trading plugin can process 1 order per time. It means all orders that are generated by the strategies are put into a queue and sent one by one to the API. Once one order is sent, the trading engine starts sending the next order. That is not technically possible to send two orders simultaneously to one API.

I understand that it is not possible to process orders simultaneously and that there is some serialization with one trading plugin. I am trying to understand the degree of serialization. Lets say 2 charts with symbols A and B trading with 1 minute resolution had buy orders at end of same 1 minute interval. The order engine sends order A to broker. Does it wait for broker to acknowledge receipt of order A before sending order B or does it send order B as soon as order A is out from its queue?
If there are two APIs (two different brokers) – then two orders can be sent almost at the same time. Each chart with a strategy will get one flow. Each trading instance will get one flow. 4 cores can get 1 flow each and supply parallel calculation. But if you have a single broker profile then the amount of cores you have will not help to process the orders faster.
1. Can you please clarify/define what you mean by "flow"? Does flow mean "thread for computing the chart strategy" or does flow mean "TCP flow" since presumably the broker connection is over TCP and you are constrained to one TCP connection with broker?

2. Can you also please clarify/define what you mean by "trading instance"? Is trading instance the same as a "broker API connection" or is it "a single chart" or is it "a group of charts with a common plugin"?

Thanks.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Connecting to different accounts with same API. Possible

Postby Henry MultiСharts » 05 Feb 2015

Ok Henry, I see what you're saying.
Technically then, two different brokers using the same order routing platforms (e.g. Patsystems in this case) each with their own different trade and price server IP addresses should make it technically possible to route in parallel, as they only share the name "Patsystems" in common and nothing else.
I guess the issue is needing to create a second plugin instance??
If this is technically possible, then let me know and I'll put in a request into project management. The need to create multiple plugin instances would also effect platforms like TT, Rithmic etc when connected to multiple brokers sharing the same routing platform.
There is a single instance of trading engine that pushes the orders to the APIs. That is not technically possible to have two instances of it.
Two PATS/Rithmic broker profiles with different settings will bring up two API instances for sending orders.
For ТТ orders will go through one process.
On the other hand, I suppose an option is to rent another server and purchase another Multicharts license.
Yes, that is possible.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Connecting to different accounts with same API. Possible

Postby Henry MultiСharts » 05 Feb 2015

Henry, I have some questions on this topic.
One trading plugin can process 1 order per time. It means all orders that are generated by the strategies are put into a queue and sent one by one to the API. Once one order is sent, the trading engine starts sending the next order. That is not technically possible to send two orders simultaneously to one API.

I understand that it is not possible to process orders simultaneously and that there is some serialization with one trading plugin. I am trying to understand the degree of serialization. Lets say 2 charts with symbols A and B trading with 1 minute resolution had buy orders at end of same 1 minute interval. The order engine sends order A to broker. Does it wait for broker to acknowledge receipt of order A before sending order B or does it send order B as soon as order A is out from its queue?
Each chart has his own trading instance for processing the orders. So order A and B from different charts do not know about one another and are being sent independently.
If there are two APIs (two different brokers) – then two orders can be sent almost at the same time. Each chart with a strategy will get one flow. Each trading instance will get one flow. 4 cores can get 1 flow each and supply parallel calculation. But if you have a single broker profile then the amount of cores you have will not help to process the orders faster.
1. Can you please clarify/define what you mean by "flow"? Does flow mean "thread for computing the chart strategy" or does flow mean "TCP flow" since presumably the broker connection is over TCP and you are constrained to one TCP connection with broker?
By "flow" I was referring to "thread for computing".
2. Can you also please clarify/define what you mean by "trading instance"? Is trading instance the same as a "broker API connection" or is it "a single chart" or is it "a group of charts with a common plugin"?
Trading instance is a thread for computing that manages the orders for a given chart (pushes them to the API, modifies/cancels orders).

orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

Re: Connecting to different accounts with same API. Possible

Postby orion » 18 Feb 2015

Trading instance is a thread for computing that manages the orders for a given chart (pushes them to the API, modifies/cancels orders).
Henry, how is this handled in the PT where there is only one broker plugin? Say strategies for symbols A, B, C generate orders on same bar close at 10:35:05 on 5 second resolution data. Two questions:
1. I assume that since there is only one plugin, the orders are serialized. Correct?
2. If they are serialized, can you clarify the degree of serialization in the order engine. After sending order A, does the order engine wait for broker ack for A before processing order B or does it fire the orders one after the other without waiting for acks?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Connecting to different accounts with same API. Possible

Postby Henry MultiСharts » 19 Feb 2015

Trading instance is a thread for computing that manages the orders for a given chart (pushes them to the API, modifies/cancels orders).
Henry, how is this handled in the PT where there is only one broker plugin? Say strategies for symbols A, B, C generate orders on same bar close at 10:35:05 on 5 second resolution data. Two questions:
1. I assume that since there is only one plugin, the orders are serialized. Correct?
2. If they are serialized, can you clarify the degree of serialization in the order engine. After sending order A, does the order engine wait for broker ack for A before processing order B or does it fire the orders one after the other without waiting for acks?
Portfolio works similar to charts - each strategy (each data1 instrument) has his own trading instance for processing the orders. So orders from different strategies do not know about one another and are being sent independently. Order acknowledgement comes asynchronously, so it can be before sending the next order or after that.


Return to “MultiCharts”