Topics
Forum Topics not found
Replies
amusleh
13 Jan 2022, 19:10
RE: RE:
v.fiodorov83 said:
amusleh said:
Hi,
You don't have to use this library for sending alerts to Telegram, you can use the Telegram .NET library that I mentioned on my first post.
You can also code the whole API interaction by yourself, you don't have to use any library, but they will make it much easier for you.
Well, you see, it turns out that if somewhere you have some library or dependency has the wrong version, different in x.x.x.x.1, then all this will not work and find where exactly the problem is unrealistic to find.
Nevertheless, thank you for your help and have a nice day.
Hi,
Telegram.Bot library can't deserialize the conversation updates, because one of the fields that must be integer comes as an empty string.
Either its the error code or the update ID, those are integers.
To find what's causing this issue, open the Telegram Bot API getUpdates on your browser: api.telegram.org/bot<your Bot Token>/getUpdates
Replace "your Bot Token" with your bot token, and post the response here.
@amusleh
amusleh
13 Jan 2022, 17:44
Hi,
For calculating the monetary value of a symbol pip/tick please follow this tutorial: Profit/Loss Calculation - Open API (spotware.github.io)
@amusleh
amusleh
13 Jan 2022, 17:40
Hi,
You don't have to use this library for sending alerts to Telegram, you can use the Telegram .NET library that I mentioned on my first post.
You can also code the whole API interaction by yourself, you don't have to use any library, but they will make it much easier for you.
@amusleh
amusleh
13 Jan 2022, 14:54
( Updated at: 13 Jan 2022, 18:54 )
RE: RE:
v.fiodorov83 said:
amusleh said:
Hi,
Just tested it with the code you posted, worked fine on my system, the popup showed up and I got a message on Telegram.
Did you made any kind of change on the code? or you used the same exact posted code?
I noticed the following in the error text. In the very first line of the log
.....Culture=neutral, PublicKeyToken=null]]. The value ' ' cannot be parsed as the type 'Int32'.
It turns out that he passes NULL instead of a token, and then he tries to pass the value " ", converting it to Int32 (Failed and an error is thrown )
No, that's not the case.
It looks like something is going wrong in de-serialization.
I recorded a video that shows it's working fine on my system:
@amusleh
amusleh
13 Jan 2022, 14:47
RE: RE:
tippy said:
ok, it seems to work well on your system.
Could you please check missing trendbar with timestamps?
request.fromTimestamp = 1578362820*1000 # 2020-01-07 02:07:00 GMT request.toTimestamp = 1578363000*1000 # 2020-01-07 02:10:00 GMT
The bar data can be missed if there was no incoming price during that bar period, so it looks like the price didn't changed from previous bar close to this bar close.
@amusleh
amusleh
13 Jan 2022, 09:03
RE: RE:
tippy said:
thanks for response. I have noticed that first run is ok, problem occurs after another execution. Could you try execute sendProtoOAGetTrendbarsReq multiple times and check if it is ok?
I have another issue, is it normal that some of trendbars are missing in historical data for EURUSD on M1? I am using a demo account from the IC Markets.
Hi,
I tested sendProtoOAGetTrendbarsReq by calling it 5 times in a row, here is the result:
Message received:
ctidTraderAccountId: 22415253
period: D1
timestamp: 1642024800000
trendbar {
volume: 98597
low: 112847
deltaOpen: 273
deltaClose: 139
deltaHigh: 471
utcTimestampInMinutes: 27357000
}
trendbar {
volume: 85986
low: 112901
deltaOpen: 63
deltaClose: 712
deltaHigh: 747
utcTimestampInMinutes: 27358440
}
trendbar {
volume: 91747
low: 112851
deltaOpen: 709
deltaClose: 430
deltaHigh: 757
utcTimestampInMinutes: 27362760
}
trendbar {
volume: 87745
low: 113130
deltaOpen: 122
deltaClose: 555
deltaHigh: 621
utcTimestampInMinutes: 27364200
}
trendbar {
volume: 94871
low: 113547
deltaOpen: 126
deltaClose: 866
deltaHigh: 980
utcTimestampInMinutes: 27365640
}
symbolId: 1
Message received:
ctidTraderAccountId: 22415253
period: D1
timestamp: 1642024800000
trendbar {
volume: 98597
low: 112847
deltaOpen: 273
deltaClose: 139
deltaHigh: 471
utcTimestampInMinutes: 27357000
}
trendbar {
volume: 85986
low: 112901
deltaOpen: 63
deltaClose: 712
deltaHigh: 747
utcTimestampInMinutes: 27358440
}
trendbar {
volume: 91747
low: 112851
deltaOpen: 709
deltaClose: 430
deltaHigh: 757
utcTimestampInMinutes: 27362760
}
trendbar {
volume: 87745
low: 113130
deltaOpen: 122
deltaClose: 555
deltaHigh: 621
utcTimestampInMinutes: 27364200
}
trendbar {
volume: 94871
low: 113547
deltaOpen: 126
deltaClose: 866
deltaHigh: 980
utcTimestampInMinutes: 27365640
}
symbolId: 1
Message received:
ctidTraderAccountId: 22415253
period: D1
timestamp: 1642024800000
trendbar {
volume: 98597
low: 112847
deltaOpen: 273
deltaClose: 139
deltaHigh: 471
utcTimestampInMinutes: 27357000
}
trendbar {
volume: 85986
low: 112901
deltaOpen: 63
deltaClose: 712
deltaHigh: 747
utcTimestampInMinutes: 27358440
}
trendbar {
volume: 91747
low: 112851
deltaOpen: 709
deltaClose: 430
deltaHigh: 757
utcTimestampInMinutes: 27362760
}
trendbar {
volume: 87745
low: 113130
deltaOpen: 122
deltaClose: 555
deltaHigh: 621
utcTimestampInMinutes: 27364200
}
trendbar {
volume: 94871
low: 113547
deltaOpen: 126
deltaClose: 866
deltaHigh: 980
utcTimestampInMinutes: 27365640
}
symbolId: 1
Message received:
ctidTraderAccountId: 22415253
period: D1
timestamp: 1642024800000
trendbar {
volume: 98597
low: 112847
deltaOpen: 273
deltaClose: 139
deltaHigh: 471
utcTimestampInMinutes: 27357000
}
trendbar {
volume: 85986
low: 112901
deltaOpen: 63
deltaClose: 712
deltaHigh: 747
utcTimestampInMinutes: 27358440
}
trendbar {
volume: 91747
low: 112851
deltaOpen: 709
deltaClose: 430
deltaHigh: 757
utcTimestampInMinutes: 27362760
}
trendbar {
volume: 87745
low: 113130
deltaOpen: 122
deltaClose: 555
deltaHigh: 621
utcTimestampInMinutes: 27364200
}
trendbar {
volume: 94871
low: 113547
deltaOpen: 126
deltaClose: 866
deltaHigh: 980
utcTimestampInMinutes: 27365640
}
symbolId: 1
Message received:
ctidTraderAccountId: 22415253
period: D1
timestamp: 1642024800000
trendbar {
volume: 98597
low: 112847
deltaOpen: 273
deltaClose: 139
deltaHigh: 471
utcTimestampInMinutes: 27357000
}
trendbar {
volume: 85986
low: 112901
deltaOpen: 63
deltaClose: 712
deltaHigh: 747
utcTimestampInMinutes: 27358440
}
trendbar {
volume: 91747
low: 112851
deltaOpen: 709
deltaClose: 430
deltaHigh: 757
utcTimestampInMinutes: 27362760
}
trendbar {
volume: 87745
low: 113130
deltaOpen: 122
deltaClose: 555
deltaHigh: 621
utcTimestampInMinutes: 27364200
}
trendbar {
volume: 94871
low: 113547
deltaOpen: 126
deltaClose: 866
deltaHigh: 980
utcTimestampInMinutes: 27365640
}
symbolId: 1
The code I used:
def sendProtoOAGetTrendbarsReq(weeks, period, symbolId, clientMsgId = None, numberOfCalls = 0):
if numberOfCalls == 5:
return
request = ProtoOAGetTrendbarsReq()
request.ctidTraderAccountId = currentAccountId
request.period = ProtoOATrendbarPeriod.Value(period)
request.fromTimestamp = int((datetime.datetime.utcnow() - datetime.timedelta(weeks=int(weeks))).timestamp()) * 1000
request.toTimestamp = int(datetime.datetime.utcnow().timestamp()) * 1000
request.symbolId = int(symbolId)
deferred = client.send(request, clientMsgId = clientMsgId)
deferred.addErrback(onError)
numberOfCalls += 1
sendProtoOAGetTrendbarsReq(weeks, period, symbolId, clientMsgId, numberOfCalls)
Regarding missing data, no, its not normal, most probably something is wrong with your code.
Please check the limits on documentation: https://spotware.github.io/open-api-docs/messages/#protooagettrendbarsreq
If you ask for more data than allowed you have to send multiple requests.
@amusleh
amusleh
13 Jan 2022, 08:21
( Updated at: 21 Dec 2023, 09:22 )
RE:
ycomp said:
I think I'm misunderstanding something.
So far I only run bots on the automate section charts.
Is there a way to run a bot I developed on the regular, trading section chart?
Hi,
Yes, you should use the regular trade charts for running cBots, not the automate section.
To run a cBot click on cBots icon:
@amusleh
amusleh
13 Jan 2022, 08:18
Hi,
The new event args gives you all the chart objects that were updated, not just one object, because multiple objects can be updated at the same time.
To find the object that you are looking for you can use Linq, ex:
private void Chart_ObjectsUpdated(ChartObjectsUpdatedEventArgs obj)
{
var verticalLine = obj.ChartObjects.FirstOrDefault(iObject => iObject.ObjectType == ChartObjectType.VerticalLine
&& iObject.Name.Equals("VerticalLine_name", StringComparison.OrdinalIgnoreCase));
if (verticalLine != null)
{
}
}
Here I check if there is an updated object that's vertical line and its name is "VerticalLine_name", if there is such an object we will get it otherwise the result will be null.
@amusleh
amusleh
12 Jan 2022, 10:04
( Updated at: 12 Jan 2022, 10:30 )
Hi,
I tested on our QuickFIXn console sample, I subscribed to 200 symbols and waited for an hour, no disconnection and it's still running.
To subscribe on multiple symbols on console sample change the code of its ExecuteAction method to this:
private static async void ExecuteAction(char action, string[] fields)
{
switch (action)
{
case '1':
SendNewOrderSingle(fields);
break;
case '2':
SendCancelOrder(fields);
break;
case '3':
SendReplaceOrder(fields);
break;
case '4':
//SendMarketDataRequest(fields, true);
for (int i = 1; i < 200; i++)
{
SendMarketDataRequest(new[] {i.ToString(), "n"}, true);
await System.Threading.Tasks.Task.Delay(1000);
}
break;
case '5':
SendMarketDataRequest(fields, false);
break;
case '6':
SendOrderMassStatusRequest(fields);
break;
case '7':
SendRequestForPositions(fields);
break;
case '8':
SendSecurityListRequest(fields);
break;
case '9':
SendOrderStatusRequest(fields);
break;
}
}
Then enter this command: 4|1|n
@amusleh
amusleh
12 Jan 2022, 09:12
Hi,
I just tested the console app, I created a new copy of sendProtoOAGetTrendbarsReq method and called it from original one, the code looks like this (line 186):
def sendProtoOAGetTrendbarsReq(weeks, period, symbolId, clientMsgId = None):
request = ProtoOAGetTrendbarsReq()
request.ctidTraderAccountId = currentAccountId
request.period = ProtoOATrendbarPeriod.Value(period)
request.fromTimestamp = int((datetime.datetime.utcnow() - datetime.timedelta(weeks=int(weeks))).timestamp()) * 1000
request.toTimestamp = int(datetime.datetime.utcnow().timestamp()) * 1000
request.symbolId = int(symbolId)
deferred = client.send(request, clientMsgId = clientMsgId)
deferred.addErrback(onError)
sendProtoOAGetTrendbarsReq2(weeks, period, symbolId, clientMsgId)
def sendProtoOAGetTrendbarsReq2(weeks, period, symbolId, clientMsgId = None):
request = ProtoOAGetTrendbarsReq()
request.ctidTraderAccountId = currentAccountId
request.period = ProtoOATrendbarPeriod.Value(period)
request.fromTimestamp = int((datetime.datetime.utcnow() - datetime.timedelta(weeks=int(weeks))).timestamp()) * 1000
request.toTimestamp = int(datetime.datetime.utcnow().timestamp()) * 1000
request.symbolId = int(symbolId)
deferred = client.send(request, clientMsgId = clientMsgId)
deferred.addErrback(onError)
Then I sent a ProtoOAGetTrendbarsReq with these parameters: 1 D1 1
Here is the response:
Message received:
ctidTraderAccountId: 22415253
period: D1
timestamp: 1641938400000
trendbar {
volume: 90020
low: 112770
deltaOpen: 69
deltaClose: 355
deltaHigh: 694
utcTimestampInMinutes: 27355560
}
trendbar {
volume: 98597
low: 112847
deltaOpen: 273
deltaClose: 139
deltaHigh: 471
utcTimestampInMinutes: 27357000
}
trendbar {
volume: 85986
low: 112901
deltaOpen: 63
deltaClose: 712
deltaHigh: 747
utcTimestampInMinutes: 27358440
}
trendbar {
volume: 91747
low: 112851
deltaOpen: 709
deltaClose: 430
deltaHigh: 757
utcTimestampInMinutes: 27362760
}
trendbar {
volume: 87745
low: 113130
deltaOpen: 122
deltaClose: 555
deltaHigh: 621
utcTimestampInMinutes: 27364200
}
symbolId: 1
Message received:
ctidTraderAccountId: 22415253
period: D1
timestamp: 1641938400000
trendbar {
volume: 90020
low: 112770
deltaOpen: 69
deltaClose: 355
deltaHigh: 694
utcTimestampInMinutes: 27355560
}
trendbar {
volume: 98597
low: 112847
deltaOpen: 273
deltaClose: 139
deltaHigh: 471
utcTimestampInMinutes: 27357000
}
trendbar {
volume: 85986
low: 112901
deltaOpen: 63
deltaClose: 712
deltaHigh: 747
utcTimestampInMinutes: 27358440
}
trendbar {
volume: 91747
low: 112851
deltaOpen: 709
deltaClose: 430
deltaHigh: 757
utcTimestampInMinutes: 27362760
}
trendbar {
volume: 87745
low: 113130
deltaOpen: 122
deltaClose: 555
deltaHigh: 621
utcTimestampInMinutes: 27364200
}
symbolId: 1
As you can see I received two responses.
@amusleh
amusleh
12 Jan 2022, 08:30
RE:
slukk200 said:
I just tried it with 5 symbols, and it has been working perfectly for 2 hours so far.
-Is there a limitation on how many symbols can I connect to or how many messages can I recieve?
-Or maybe there are some limitations of the demo accounts?
-Should connect to one symbol per session only and have 80 different sessions?
-ReconnectInterval=900000, I see that people usually set it to around 20. Could this be the problem?
Unfortunately I couldn't find anything about limitations in the document, so if anyone knows anything about it, please share.
Hi,
I'm not aware of any limitation on number of symbols you can subscribe.
Maybe you are not processing fast enough the incoming data and your buffer gets overflow.
@amusleh
amusleh
12 Jan 2022, 08:26
RE: RE:
FVAp said:
amusleh said:
Hi,
You can't check/uncheck the outputs with code.
Hi, thanks for your reply.
Is there, at least a way I can change Output Thickness?
If I cant uncheck output with code, maybe I can change Output line thickness to 0, it is possible?
Hi,
Right now you can't change any of the output properties programmatically, to hide an output you can set its value to double.NAN.
@amusleh
amusleh
11 Jan 2022, 12:46
Hi,
The issue has been resolved.
Please try our .NET samples on OpenAPI.NET repository: spotware/OpenAPI.Net: Spotware Open API .NET Rx library (github.com)
The old samples might not work.
@amusleh
amusleh
14 Jan 2022, 09:53 ( Updated at: 21 Dec 2023, 09:22 )
RE: RE: RE: RE:
v.fiodorov83 said:
Hi,
Can you please post the raw full JSON response, so I will be able to deserialize it on my system and see what's wrong.
@amusleh