Login Page - Create Account

Support Board


Date/Time: Sat, 20 Apr 2024 01:00:12 +0000



API error msg

View Count: 747

[2020-03-11 17:00:12]
77sx7 - Posts: 16
Im trying to access my trades via Api through Powershell
> When I do an Invoke-RestMethod I get the error msg ERROR: Call not
> supported: Message.
> Is my account setup to do this?
>
> I have SEND ORDER FILLS TO SC WEB SERVER is enabled.

>
> I appreciate any assistance.
>
[2020-03-11 18:03:57]
Sierra Chart Engineering - Posts: 104368
Tell us the very specific web-based call you are using. Leave out any password.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2020-03-11 18:42:26]
77sx7 - Posts: 16
Using Powershell...
$postParams = @{AdminUsername='*****';AdminPassword='******';
UserSCUsername='********';Service='GetTradeOrderFills';
StartDateTimeUTC='2019-12-20 00:00:00'}
$Sc = Invoke-RestMethod -Uri https://www.sierrachart.com/API.php -Method POST -Body $postParams -ContentType "application/json"

Thank you
[2020-03-11 20:21:50]
Sierra Chart - Max - Posts: 5590
Are you setting the AdminUsername to your Sierra Chart account?

Note for your case UserSCUsername and AdminUsername should be same value (Your Sierra Chart account name). And AdminPassword should be set to your password.


You might want to omit the "-ContentType".
Sierra Chart Support
Date Time Of Last Edit: 2020-03-11 20:23:05
[2020-03-11 20:38:08]
77sx7 - Posts: 16
Yes authentication seems to be right. If I use a web-invoke instead of Invoke-restmethod can get content, but the json isn't in correct format?.


I can also try omitting the content type.
[2020-03-11 20:57:29]
Sierra Chart - Max - Posts: 5590
It needs to be a normal post, which according to the documentation requires no ContentType.
Sierra Chart Support
[2020-03-11 22:25:51]
77sx7 - Posts: 16
No Contenttype solved my issue.
THANK YOU!

SOLUTION FINAL CODE

$postParams = @{AdminUsername='*****';AdminPassword='*****';
UserSCUsername='*****';Service='GetTradeOrderFills';
StartDateTimeUTC='2018-12-20 00:00:00'}
$Sc = Invoke-RestMethod -Uri https://www.sierrachart.com/API.php -Method POST -Body $postParams
[2020-09-25 02:15:11]
77sx7 - Posts: 16
Im attempting to use API with same code as in previous post.. This worked in March..Did anything change since March on using this?

I get error:
Invoke-RestMethod : The remote server returned an error: (500) Internal Server Error.

Is it possible to query 'Period Stats' through API?

Thanks in advance
[2020-09-25 05:00:13]
Sierra Chart Engineering - Posts: 104368
You have to be authorized to be able to use that API.

Is it possible to query 'Period Stats' through API?
No this only exists within Sierra Chart. You would need to export this data:
Trade Activity Log: Importing and Exporting Data
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2020-09-25 05:00:27

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account