Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) ETrade v1 List OrdersGets the order details for a selected brokerage account based on the search criteria provided.
integer li_rc oleobject loo_Http oleobject loo_Json integer li_Success string ls_RespStr integer li_StatusCode oleobject loo_Xml integer i integer li_Count_i string ls_TagPath integer li_OrderId string ls_Details string ls_OrderType string ls_OrderDetail // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loo_Http = create oleobject // Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") if li_rc < 0 then destroy loo_Http MessageBox("Error","Connecting to COM object failed") return end if loo_Http.OAuth1 = 1 loo_Http.OAuthVerifier = "" loo_Http.OAuthConsumerKey = "ETRADE_CONSUMER_KEY" loo_Http.OAuthConsumerSecret = "ETRADE_CONSUMER_SECRET" // Load the access token previously obtained via the OAuth1 3-Legged Authorization examples Step1 and Step2. loo_Json = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject") li_Success = loo_Json.LoadFile("qa_data/tokens/etrade.json") if li_Success <> 1 then Write-Debug "Failed to load OAuth1 token" destroy loo_Http destroy loo_Json return end if loo_Http.OAuthToken = loo_Json.StringOf("oauth_token") loo_Http.OAuthTokenSecret = loo_Json.StringOf("oauth_token_secret") // See the ETrade v1 API documentation HERE. loo_Http.SetUrlVar("accountIdKey","vsnhtF7d9jXxBy6HyaAC4vQ") ls_RespStr = loo_Http.QuickGetStr("https://apisb.etrade.com/v1/accounts/{$accountIdKey}/orders?securityType=EQ&count=100") if loo_Http.LastMethodSuccess <> 1 then Write-Debug loo_Http.LastErrorText destroy loo_Http destroy loo_Json return end if // A 200 status code indicates success. li_StatusCode = loo_Http.LastStatus Write-Debug "statusCode = " + string(li_StatusCode) // Use the following online tool to generate parsing code from sample XML: // Generate Parsing Code from XML // A sample XML response is shown below... loo_Xml = create oleobject // Use "Chilkat_9_5_0.Xml" for versions of Chilkat < 10.0.0 li_rc = loo_Xml.ConnectToNewObject("Chilkat.Xml") loo_Xml.LoadXml(ls_RespStr) i = 0 li_Count_i = loo_Xml.NumChildrenHavingTag("Order") do while i < li_Count_i loo_Xml.I = i li_OrderId = loo_Xml.GetChildIntValue("Order[i]|orderId") ls_Details = loo_Xml.GetChildContent("Order[i]|details") ls_OrderType = loo_Xml.GetChildContent("Order[i]|orderType") ls_OrderDetail = loo_Xml.GetChildContent("Order[i]|OrderDetail") i = i + 1 loop // Sample XML Response // <?xml version="1.0" encoding="UTF-8"?> // <OrdersResponse> // <Order> // <orderId>96</orderId> // <details>https://api.etrade.com/v1/accounts/ZrnXF-hPu853sBzwHfWGBQ/orders/96</details> // <orderType>EQ</orderType> // <OrderDetail>�</OrderDetail> // </Order> // <Order> // <orderId>95</orderId> // <details>https://api.etrade.com/v1/accounts/ZrnXF-hPu853sBzwHfWGBQ/orders/95</details> // <orderType>EQ</orderType> // <OrderDetail>�</OrderDetail> // </Order> // <Order> // <orderId>94</orderId> // <details>https://api.etrade.com/v1/accounts/ZrnXF-hPu853sBzwHfWGBQ/orders/94</details> // <orderType>EQ</orderType> // <OrderDetail>�</OrderDetail> // </Order> // <Order> // <orderId>93</orderId> // <details>https://api.etrade.com/v1/accounts/ZrnXF-hPu853sBzwHfWGBQ/orders/93</details> // <orderType>EQ</orderType> // <OrderDetail>�</OrderDetail> // </Order> // </OrdersResponse> destroy loo_Http destroy loo_Json destroy loo_Xml |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.