Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

PowerBuilder Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(PowerBuilder) ETrade Get Account Balances

Retrieves the current account balance and related details for a specified account.

For more information, see https://apisb.etrade.com/docs/api/account/api-balance-v1.html

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

integer li_rc
oleobject loo_Http
oleobject loo_JsonToken
integer li_Success
string ls_SandboxUrl
string ls_LiveUrl
oleobject loo_Resp
oleobject loo_Xml
integer li_AccountId
string ls_AccountType
string ls_OptionLevel
string ls_AccountDescription
integer li_QuoteMode
string ls_DayTraderStatus
string ls_AccountMode
integer li_FundsForOpenOrdersCash
integer li_MoneyMktBalance
integer li_CashAvailableForInvestment
string ls_NetCash
string ls_CashBalance
integer li_SettledCashForInvestment
integer li_UnSettledCashForInvestment
integer li_FundsWithheldFromPurchasePower
integer li_FundsWithheldFromWithdrawal
integer li_MarginBuyingPower
string ls_CashBuyingPower
integer li_DtMarginBuyingPower
integer li_DtCashBuyingPower
integer li_ShortAdjustBalance
integer li_RegtEquity
integer li_RegtEquityPercent
integer li_AccountBalance
integer li_DtCashOpenOrderReserve
integer li_DtMarginOpenOrderReserve

// This requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.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 Authorization
loo_JsonToken = create oleobject
li_rc = loo_JsonToken.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

li_Success = loo_JsonToken.LoadFile("qa_data/tokens/etrade.json")
if li_Success <> 1 then
    Write-Debug "Failed to load OAuth1 token"
    destroy loo_Http
    destroy loo_JsonToken
    return
end if

loo_Http.OAuthToken = loo_JsonToken.StringOf("oauth_token")
loo_Http.OAuthTokenSecret = loo_JsonToken.StringOf("oauth_token_secret")

ls_SandboxUrl = "https://apisb.etrade.com/v1/accounts/{$accountIdKey}/balance?instType={$instType}&realTimeNAV=true"
ls_LiveUrl = "https://api.etrade.com/v1/accounts/{$accountIdKey}/balance?instType={$instType}&realTimeNAV=true"

loo_Http.SetUrlVar("accountIdKey","6_Dpy0rmuQ9cu9IbTfvF2A")
loo_Http.SetUrlVar("instType","BROKERAGE")

loo_Resp = loo_Http.QuickGetObj(ls_SandboxUrl)
if loo_Http.LastMethodSuccess <> 1 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_JsonToken
    return
end if

// Make sure a successful response was received.
if loo_Resp.StatusCode > 200 then
    Write-Debug loo_Resp.StatusLine
    Write-Debug loo_Resp.Header
    Write-Debug loo_Resp.BodyStr
    destroy loo_Http
    destroy loo_JsonToken
    return
end if

// Sample XML response:

// Use this online tool to generate parsing code from sample XML: 
// Generate Parsing Code from XML

// <?xml version="1.0" encoding="UTF-8"?>
// <BalanceResponse>
//    <accountId>83564979</accountId>
//    <accountType>PDT_ACCOUNT</accountType>
//    <optionLevel>LEVEL_4</optionLevel>
//    <accountDescription>KRITHH TT</accountDescription>
//    <quoteMode>6</quoteMode>
//    <dayTraderStatus>PDT_MIN_EQUITY_RES_1XK</dayTraderStatus>
//    <accountMode>PDT ACCOUNT</accountMode>
//    <Cash>
//       <fundsForOpenOrdersCash>0</fundsForOpenOrdersCash>
//       <moneyMktBalance>0</moneyMktBalance>
//    </Cash>
//    <Computed>
//       <cashAvailableForInvestment>0</cashAvailableForInvestment>
//       <netCash>93921.44</netCash>
//       <cashBalance>93921.44</cashBalance>
//       <settledCashForInvestment>0</settledCashForInvestment>
//       <unSettledCashForInvestment>0</unSettledCashForInvestment>
//       <fundsWithheldFromPurchasePower>0</fundsWithheldFromPurchasePower>
//       <fundsWithheldFromWithdrawal>0</fundsWithheldFromWithdrawal>
//       <marginBuyingPower>0</marginBuyingPower>
//       <cashBuyingPower>93921.44</cashBuyingPower>
//       <dtMarginBuyingPower>0</dtMarginBuyingPower>
//       <dtCashBuyingPower>0</dtCashBuyingPower>
//       <shortAdjustBalance>0</shortAdjustBalance>
//       <regtEquity>0</regtEquity>
//       <regtEquityPercent>0</regtEquityPercent>
//       <accountBalance>0</accountBalance>
//    </Computed>
//    <Margin>
//       <dtCashOpenOrderReserve>0</dtCashOpenOrderReserve>
//       <dtMarginOpenOrderReserve>0</dtMarginOpenOrderReserve>
//    </Margin>
// </BalanceResponse>

loo_Xml = create oleobject
li_rc = loo_Xml.ConnectToNewObject("Chilkat_9_5_0.Xml")

loo_Xml.LoadXml(loo_Resp.BodyStr)
Write-Debug loo_Xml.GetXml()

li_AccountId = loo_Xml.GetChildIntValue("accountId")
ls_AccountType = loo_Xml.GetChildContent("accountType")
ls_OptionLevel = loo_Xml.GetChildContent("optionLevel")
ls_AccountDescription = loo_Xml.GetChildContent("accountDescription")
li_QuoteMode = loo_Xml.GetChildIntValue("quoteMode")
ls_DayTraderStatus = loo_Xml.GetChildContent("dayTraderStatus")
ls_AccountMode = loo_Xml.GetChildContent("accountMode")
li_FundsForOpenOrdersCash = loo_Xml.GetChildIntValue("Cash|fundsForOpenOrdersCash")
li_MoneyMktBalance = loo_Xml.GetChildIntValue("Cash|moneyMktBalance")
li_CashAvailableForInvestment = loo_Xml.GetChildIntValue("Computed|cashAvailableForInvestment")
ls_NetCash = loo_Xml.GetChildContent("Computed|netCash")
ls_CashBalance = loo_Xml.GetChildContent("Computed|cashBalance")
li_SettledCashForInvestment = loo_Xml.GetChildIntValue("Computed|settledCashForInvestment")
li_UnSettledCashForInvestment = loo_Xml.GetChildIntValue("Computed|unSettledCashForInvestment")
li_FundsWithheldFromPurchasePower = loo_Xml.GetChildIntValue("Computed|fundsWithheldFromPurchasePower")
li_FundsWithheldFromWithdrawal = loo_Xml.GetChildIntValue("Computed|fundsWithheldFromWithdrawal")
li_MarginBuyingPower = loo_Xml.GetChildIntValue("Computed|marginBuyingPower")
ls_CashBuyingPower = loo_Xml.GetChildContent("Computed|cashBuyingPower")
li_DtMarginBuyingPower = loo_Xml.GetChildIntValue("Computed|dtMarginBuyingPower")
li_DtCashBuyingPower = loo_Xml.GetChildIntValue("Computed|dtCashBuyingPower")
li_ShortAdjustBalance = loo_Xml.GetChildIntValue("Computed|shortAdjustBalance")
li_RegtEquity = loo_Xml.GetChildIntValue("Computed|regtEquity")
li_RegtEquityPercent = loo_Xml.GetChildIntValue("Computed|regtEquityPercent")
li_AccountBalance = loo_Xml.GetChildIntValue("Computed|accountBalance")
li_DtCashOpenOrderReserve = loo_Xml.GetChildIntValue("Margin|dtCashOpenOrderReserve")
li_DtMarginOpenOrderReserve = loo_Xml.GetChildIntValue("Margin|dtMarginOpenOrderReserve")

Write-Debug "Success."


destroy loo_Http
destroy loo_JsonToken
destroy loo_Xml

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.