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
(DataFlex) ETrade v1 List OrdersGets the order details for a selected brokerage account based on the search criteria provided.
Use ChilkatAx-win32.pkg Procedure Test Handle hoHttp Handle hoJson Boolean iSuccess String sRespStr Integer iStatusCode Handle hoXml Integer i Integer iCount_i String sTagPath Integer iOrderId String sDetails String sOrderType String sOrderDetail String sTemp1 Boolean bTemp1 // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End Set ComOAuth1 Of hoHttp To True Set ComOAuthVerifier Of hoHttp To "" Set ComOAuthConsumerKey Of hoHttp To "ETRADE_CONSUMER_KEY" Set ComOAuthConsumerSecret Of hoHttp To "ETRADE_CONSUMER_SECRET" // Load the access token previously obtained via the OAuth1 3-Legged Authorization examples Step1 and Step2. Get Create (RefClass(cComChilkatJsonObject)) To hoJson If (Not(IsComObjectCreated(hoJson))) Begin Send CreateComObject of hoJson End Get ComLoadFile Of hoJson "qa_data/tokens/etrade.json" To iSuccess If (iSuccess <> True) Begin Showln "Failed to load OAuth1 token" Procedure_Return End Get ComStringOf Of hoJson "oauth_token" To sTemp1 Set ComOAuthToken Of hoHttp To sTemp1 Get ComStringOf Of hoJson "oauth_token_secret" To sTemp1 Set ComOAuthTokenSecret Of hoHttp To sTemp1 // See the ETrade v1 API documentation HERE. Get ComSetUrlVar Of hoHttp "accountIdKey" "vsnhtF7d9jXxBy6HyaAC4vQ" To iSuccess Get ComQuickGetStr Of hoHttp "https://apisb.etrade.com/v1/accounts/{$accountIdKey}/orders?securityType=EQ&count=100" To sRespStr Get ComLastMethodSuccess Of hoHttp To bTemp1 If (bTemp1 <> True) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End // A 200 status code indicates success. Get ComLastStatus Of hoHttp To iStatusCode Showln "statusCode = " iStatusCode // Use the following online tool to generate parsing code from sample XML: // Generate Parsing Code from XML // A sample XML response is shown below... Get Create (RefClass(cComChilkatXml)) To hoXml If (Not(IsComObjectCreated(hoXml))) Begin Send CreateComObject of hoXml End Get ComLoadXml Of hoXml sRespStr To iSuccess Move 0 To i Get ComNumChildrenHavingTag Of hoXml "Order" To iCount_i While (i < iCount_i) Set ComI Of hoXml To i Get ComGetChildIntValue Of hoXml "Order[i]|orderId" To iOrderId Get ComGetChildContent Of hoXml "Order[i]|details" To sDetails Get ComGetChildContent Of hoXml "Order[i]|orderType" To sOrderType Get ComGetChildContent Of hoXml "Order[i]|OrderDetail" To sOrderDetail Move (i + 1) To i 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> End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.