Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error While Running the Code
Message
From
24/02/2023 10:42:57
 
 
To
21/02/2023 13:56:29
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01686245
Message ID:
01686263
Views:
80
Thank you.
I am able to open the browser, but after I give the user id and password an error is shown ( screenshot attached)

I am finding difficulty to integrate the vfp and API.


>Harsh,
>
>Open the URL non-asynchronously.
>
>loHttp.open("POST", lcUrl, .F.)
>
>
>You may also consider using a more recent and more robust version of the XML HTTP library:
>
>loHttp = CREATEOBJECT("MSXML2.ServerXMLHTTP.6.0")
>
>
>>Respected Experts
>>
>>I am getting the following error while executing the Code to call an API for Placing an order with Zerodha Brokrage
>>
>>OLE IDespatch Exception code 0 from msxml3.dll. The Data Necessary to complete this operation is not yet availalble. Can anyone Guide , how to resolve ?
>>
>>LOCAL loHttp, lcUrl, lcApiKey, lcAccessToken, lcSymbol, lnQty, lnPrice, lcExchange, lcOrderType, lcProductType, lcVariety, lcResponse
>>
>>* Replace with your API Key
>>lcApiKey = "jqcz8jsxj0mblwwl"
>>
>>* Replace with your API Access Token
>>lcAccessToken = "7p2thd5jugfeuh9q9h4n5d9rt8716q3k"
>>
>>* Replace with the symbol you want to trade
>>lcSymbol = "RELIANCE"
>>
>>* Replace with the quantity you want to trade
>>lnQty = 1
>>
>>* Replace with the price at which you want to place the order
>>lnPrice = 1000
>>
>>* Replace with the exchange on which you want to trade (NSE or BSE)
>>lcExchange = "NSE"
>>
>>* Replace with the order type (LIMIT, MARKET, SL, SLM)
>>lcOrderType = "LIMIT"
>>
>>* Replace with the product type (CNC, MIS, NRML)
>>lcProductType = "MIS"
>>
>>* Replace with the order variety (regular, amo, bo, co)
>>lcVariety = "regular"
>>
>>* Construct the API URL
>>lcUrl = "https://api.kite.trade/orders/regular"
>>
>>* Create an HTTP object
>>loHttp = CREATEOBJECT("MSXML2.XMLHTTP")
>>
>>* Set the request method and URL
>>loHttp.open("POST", lcUrl, .T.)
>>
>>* Set the request headers
>>
>>loHttp.setRequestHeader("X-Kite-Version", "3")
>>
>>loHttp.setRequestHeader("Authorization", "Bearer " + lcAccessToken)
>>
>>loHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
>>
>>* Set the request body
>>lcBody = "tradingsymbol=" + lcSymbol + "&quantity"+"=" + TRANSFORM(lnQty) + "&price"+ "=" + TRANSFORM(lnPrice) + ;
>>"&exchange"+ "=" + lcExchange + "&order_type"+ "=" + lcOrderType + "&product"+ "=" + lcProductType + "&variety"+ "=" + lcVariety
>>
>>* Send the request and get the response
>>loHttp.send(lcBody)
>>lcResponse = loHttp.responseText
>>
>>* Print the response
>>? lcResponse
Harsh
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform