Login Page - Create Account

Support Board


Date/Time: Wed, 21 Oct 2020 05:17:32 +0000



API error msg

[2020-03-11 17:00:12]
MattyHolla - Posts: 11 | Ending Date: 2020-10-31
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: 90557 | Ending Date: 2021-04-05
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. If possible please keep your questions brief and to the point. Please be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

If your question/request has been answered and you do not have anything further, then it is easiest for us if you do not reply again to say thank you.
[2020-03-11 18:42:26]
MattyHolla - Posts: 11 | Ending Date: 2020-10-31
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: 4743 | Ending Date: 2021-04-13
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]
MattyHolla - Posts: 11 | Ending Date: 2020-10-31
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: 4743 | Ending Date: 2021-04-13
It needs to be a normal post, which according to the documentation requires no ContentType.
Sierra Chart Support
[2020-03-11 22:25:51]
MattyHolla - Posts: 11 | Ending Date: 2020-10-31
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]
MattyHolla - Posts: 11 | Ending Date: 2020-10-31
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: 90557 | Ending Date: 2021-04-05
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:
https://www.sierrachart.com/index.php?page=doc/TradeActivityLog.php#ImportingExportingData
Sierra Chart Support - Engineering Level

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

If your question/request has been answered and you do not have anything further, then it is easiest for us if you do not reply again to say thank you.
Date Time Of Last Edit: 2020-09-25 05:00:27

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

Login

Login Page - Create Account