Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi i am working on an auto-trading quant app, everything is working fine and moved to the last phase but here i am facing a problem.

In brief:

No trade = 0;
Is trade = 1;

The code executes if certain conditions met and updates the database from '0' to '1', and if it's '1' then a trade position will be opened under the user's account.

Here the problem is:
It opens position one by one, meaning if i have 5000 clients then it starts opening trade position from 1st user to the last 5000th user one after.

And suppose time elapses 100ms on each trade execution then 5000 user * 100ms becomes round about 8 minutes which is really worse case for quant trading.

1. I am using Ajax and WebMethods using .net C#
2. To trade i am using WebSocket Api provided by the forex broker
3. To differentiate user's trading account i have unique api token for all


All the trade must be opened at a time so, what i am thinking is:
To execute the code to open trade position directly from the db using some StoredProcedure if user's table value is changed from '0' to '1', but don't know it's possible or not.

Please suggest me if you have any solution for this, it would be really very helpful to me and will be grateful to you forever.

Regards

What I have tried:

I am trying to execute code directly from the db using StoredProcedure
Posted
Updated 6-Aug-19 6:55am

You have to be able to "batch" if you want to get around the "one call per client".

A XML or JSON service request can include collections / lists / arrays for handling multiple "requests" in a single call ... if it is designed that way.

USPS, UPS, FedEx ... all work that way; query / post multiple options at one time.
 
Share this answer
 
Comments
GeoFinex 6-Aug-19 13:52pm    
I think indexing the users cannot be used to handle these processes, doing this will execute the code simultaneously but not as i need.

Getting idea from your word "batch".
I think i should run around "map"
Updating thousands of accounts in near real time is why trading firms have massive computing resources ... racks and racks of hardware, highly optimized software, very high bandwidth servers, routers, etc. Do you think you can get around those constraints ?
Quote:
using WebSocket Api provided by the forex broker
Have you talked to your Forex broker, and asked for information about the extent to which they accept/handle the kind of work-load you describe ? Isn't the broker the one who can tell you what you might need on your end ?
 
Share this answer
 
v2
Comments
GeoFinex 6-Aug-19 14:03pm    
Really agree you, but the Websockets api which i got is only for the startups like us not for individual traders, this ensures that it's possible

The reserved last option i have is to host the app on vm individually for each client where the trades will be executed.
But it's the last option.

Trying to get something relevant if exists.
BillWoodruff 6-Aug-19 21:49pm    
"Isn't the broker the one who can tell you what you might need on your end ?" I ask, again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900