hendrikhe Posted November 28, 2017 Posted November 28, 2017 (edited) Hello Autoit Community, I am trying to read market data from a crypto currency website. The APi documentation is here: https://braziliex.com/exchange/api.php My current script is : #include <Array.au3> #include <string.au3> #include <MsgBoxConstants.au3> Global $sBraziliexAPIUrl = "https://braziliex.com/api/v1/public/currencies" $sResults = Query() ConsoleWrite("Market Data: " & $sResults & @CRLF & @CRLF) Func Query() Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", $sBraziliexAPIUrl) Local $sReceived = $oHTTP.ResponseText Return $sReceived EndFunc But I always receive the error: ==> The requested action with this object has failed.: Local $sReceived = $oHTTP.ResponseText Local $sReceived = $oHTTP^ ERROR Edited November 28, 2017 by hendrikhe
Danp2 Posted November 28, 2017 Posted November 28, 2017 This is real simple when using the WinHTTP UDF Here's some example code -- #include "WinHttp.au3" Opt("MustDeclareVars", 1) Global $sDomain = "braziliex.com" Global $sPage = "/api/v1/public/currencies" ; Initialize and get session handle Global $hOpen = _WinHttpOpen() ; Get connection handle Global $hConnect = _WinHttpConnect($hOpen, $sDomain) ; Make a SimpleSSL request Global $hRequestSSL = _WinHttpSimpleSendSSLRequest($hConnect, Default, $sPage) ; Read... Global $sReturned = _WinHttpSimpleReadData($hRequestSSL) ConsoleWrite($sReturned & @CRLF) ; Close handles _WinHttpCloseHandle($hRequestSSL) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) hendrikhe 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
hendrikhe Posted November 28, 2017 Author Posted November 28, 2017 Thnx for the fast reply For some reason it os not writing any data in console. Also if I insert MsgBox(0,"",$sReturned) it is empty
Danp2 Posted November 28, 2017 Posted November 28, 2017 When I run this, I get the following output in the console -- {"brl":{"name":"Real","txWithdrawalFee":9,"MinWithdrawal":30,"txWithdrawalPercentageFee":0.0025,"minConf":1,"minDeposit":0,"txDepositFee":0,"txDepositPercentageFee":0,"minAmountTrade":1,"decimal":8,"active":1,"dev_active":1,"under_maintenance":0,"order":"010","is_withdrawal_active":1,"is_deposit_active":1,"user_fee":1,"market_btc_maker_fee":0,"market_btc_taker_fee":0,"market_brl_maker_fee":0,"market_brl_taker_fee":0},"btc":{"name":"Bitcoin","txWithdrawalFee":0.001,"MinWithdrawal":0.005,"txWithdrawalPercentageFee":0,"minConf":2,"minDeposit":0,"txDepositFee":0,"txDepositPercentageFee":0,"minAmountTrade":0.0001,"decimal":8,"active":1,"dev_active":1,"under_maintenance":0,"order":"020","is_withdrawal_active":1,"is_deposit_active":1,"user_fee":1,"market_btc_maker_fee":0,"market_btc_taker_fee":0,"market_brl_maker_fee":0.0025,"market_brl_taker_fee":0.005},"bch":{"name":"Bitcoin-Cash","txWithdrawalFee":0.001,"MinWithdrawal":0.005,"txWithdrawalPercentageFee":0,"minConf":2,"minDeposit":0,"txDepositFee":0,"txDepositPercentageFee":0,"minAmountTrade":0.0001,"decimal":8,"active":1,"dev_active":1,"under_maintenance":0,"order":"091","is_withdrawal_active":1,"is_deposit_active":1,"user_fee":1,"market_btc_maker_fee":0.0025,"market_btc_taker_fee":0.005,"market_brl_maker_fee":0.0025,"market_brl_taker_fee":0.005},"btg":{"name":"Bitcoin-Gold","txWithdrawalFee":0.001,"MinWithdrawal":0.005,"txWithdrawalPercentageFee":0,"minConf":3,"minDeposit":0,"txDepositFee":0,"txDepositPercentageFee":0,"minAmountTrade":0.0001,"decimal":8,"active":1,"dev_active":1,"under_maintenance":0,"order":"092","is_withdrawal_active":1,"is_deposit_active":1,"user_fee":1,"market_btc_maker_fee":0.0025,"market_btc_taker_fee":0.005,"market_brl_maker_fee":0.0025,"market_brl_taker_fee":0.005},"ltc":{"name":"Litecoin","txWithdrawalFee":0.001,"MinWithdrawal":0.01,"txWithdrawalPercentageFee":0,"minConf":3,"minDeposit":0,"txDepositFee":0,"txDepositPercentageFee":0,"minAmountTrade":0.001,"decimal":8,"active":1,"dev_active":1,"under_maintenance":0,"order":"050","is_withdrawal_active":1,"is_deposit_active":1,"user_fee":1,"market_btc_maker_fee":0.0025,"market_btc_taker_fee":0.005,"market_brl_maker_fee":0.0025,"market_brl_taker_fee":0.005},"eth":{"name":"Ethereum","txWithdrawalFee":0.002,"MinWithdrawal":0.01,"txWithdrawalPercentageFee":0,"minConf":10,"minDeposit":0.1,"txDepositFee":0,"txDepositPercentageFee":0,"minAmountTrade":0.001,"decimal":8,"active":1,"dev_active":1,"under_maintenance":0,"order":"040","is_withdrawal_active":1,"is_deposit_active":1,"user_fee":1,"market_btc_maker_fee":0.0025,"market_btc_taker_fee":0.005,"market_brl_maker_fee":0.0025,"market_brl_taker_fee":0.005},"xmr":{"name":"Monero","txWithdrawalFee":0.05,"MinWithdrawal":0.1,"txWithdrawalPercentageFee":0,"minConf":6,"minDeposit":0,"txDepositFee":0,"txDepositPercentageFee":0,"minAmountTrade":0.001,"decimal":8,"active":1,"dev_active":1,"under_maintenance":0,"order":"090","is_withdrawal_active":1,"is_deposit_active":1,"user_fee":1,"market_btc_maker_fee":0.0025,"market_btc_taker_fee":0.005,"market_brl_maker_fee":0.0025,"market_brl_taker_fee":0.005},"dash":{"name":"Dash","txWithdrawalFee":0.01,"MinWithdrawal":0.1,"txWithdrawalPercentageFee":0,"minConf":3,"minDeposit":0,"txDepositFee":0,"txDepositPercentageFee":0,"minAmountTrade":0.001,"decimal":8,"active":1,"dev_active":1,"under_maintenance":0,"order":"030","is_withdrawal_active":1,"is_deposit_active":1,"user_fee":1,"market_btc_maker_fee":0.0025,"market_btc_taker_fee":0.005,"market_brl_maker_fee":0.0025,"market_brl_taker_fee":0.005},"mxt":{"name":"MartexCoin","txWithdrawalFee":0.01,"MinWithdrawal":0.1,"txWithdrawalPercentageFee":0,"minConf":30,"minDeposit":0,"txDepositFee":0,"txDepositPercentageFee":0,"minAmountTrade":0.001,"decimal":8,"active":1,"dev_active":1,"under_maintenance":0,"order":"060","is_withdrawal_active":1,"is_deposit_active":1,"user_fee":1,"market_btc_maker_fee":0.0025,"market_btc_taker_fee":0.005,"market_brl_maker_fee":0.0025,"market_brl_taker_fee":0.005},"prsp":{"name":"Prosper","txWithdrawalFee":0.01,"MinWithdrawal":0.1,"txWithdrawalPercentageFee":0,"minConf":10,"minDeposit":0.1,"txDepositFee":0,"txDepositPercentageFee":0,"minAmountTrade":0.01,"decimal":8,"active":1,"dev_active":1,"under_maintenance":0,"is_token_erc20":1,"token_erc20_eth_deposit_fee":0.01,"token_erc20_eth_withdrawal_fee":0.01,"order":"070","is_withdrawal_active":1,"is_deposit_active":1,"user_fee":1,"market_btc_maker_fee":0.0025,"market_btc_taker_fee":0.005,"market_brl_maker_fee":0,"market_brl_taker_fee":0},"sngls":{"name":"SingularDTV","txWithdrawalFee":1,"MinWithdrawal":1,"txWithdrawalPercentageFee":0,"minConf":10,"minDeposit":1,"txDepositFee":0,"txDepositPercentageFee":0,"minAmountTrade":1,"decimal":0,"active":1,"dev_active":1,"under_maintenance":0,"is_token_erc20":1,"token_erc20_eth_deposit_fee":0.01,"token_erc20_eth_withdrawal_fee":0.01,"order":"080","is_withdrawal_active":1,"is_deposit_active":1,"user_fee":1,"market_btc_maker_fee":0.0025,"market_btc_taker_fee":0.005,"market_brl_maker_fee":0.0025,"market_brl_taker_fee":0.005}} Latest Webdriver UDF Release Webdriver Wiki FAQs
hendrikhe Posted November 28, 2017 Author Posted November 28, 2017 (edited) Hmm, not sure why it is not working for me :/ Update: looks like a problem with Scite, works on a different computer. Thnx Danp2 Edited November 28, 2017 by hendrikhe
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now