$version01 = "Version 0.4" ; SAP XEP CHROME $version01 = "DIEN + NUOC "&$version01 $version_random_id = " ID"&Random(1000,9999,1) $version01 = $version01&$version_random_id #include #include #Include #Include #include ;#include "FastFind.au3" #include #include #RequireAdmin ; ko thong bao khi thieu var co them quyen admin ghi vao bo x32 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include <[binance]\Json.au3> ;#include <[binance]\Binance UDF.au3> #include <[binance]\TableData.au3> #include "WinHttp.au3" #include Opt("MouseCoordMode", 2) ;1=absolute, 0=relative, 2=client auto_msi01() $symbol01_var = "BTC-USDT" $symbol02_var = "UNI-USDT" $symbol03_var = "ONDO-USDT" $symbol04_var = "LIN-KUSDT" $symbol05_var = "NEAR-USDT" $symbol06_var = "AAVE-USDT" ; Đường dẫn đến Chrome Local $sChromePath = "C:\Program Files\Google\Chrome\Application\chrome.exe" ; Các tùy chọn dòng lệnh Local $tivi_size01 = "--window-size=1114,642" Local $tivi_move01 = "--window-position=0,0" Local $tivi_profile01 = '--profile-directory="Profile 1"' Local $tivi_link01 ='https://www.binance.com/vi/futures/btcusdt' Local $tivi_size02 = "--window-size=1114,642" Local $tivi_move02 = "--window-position=1093,0" Local $tivi_profile02 = '--profile-directory="Profile 1"' Local $tivi_link02 ='https://www.binance.com/vi/futures/uniusdt' Local $tivi_size03 = "--window-size=1114,642" Local $tivi_move03 = "--window-position=0,556" Local $tivi_profile03 = '--profile-directory="Profile 1"' Local $tivi_link03 ='https://www.binance.com/vi/futures/avaxusdt' Local $tivi_size04 = "--window-size=1114,642" Local $tivi_move04 = "--window-position=1094,563" Local $tivi_profile04 = '--profile-directory="Profile 1"' Local $tivi_link04 ='https://www.binance.com/vi/futures/nearusdt' Local $tivi_size05 = "--window-size=1111,591" Local $tivi_move05 = "--window-position=-1104,-7" Local $tivi_profile05 = '--profile-directory="Profile 1"' Local $tivi_link05 ='https://www.binance.com/vi/futures/avaxusdt' Local $tivi_size06 = "--window-size=1111,591" Local $tivi_move06 = "--window-position=-2201,-7" Local $tivi_profile06 = '--profile-directory="Profile 1"' Local $tivi_link06 ='https://www.binance.com/vi/futures/btcusdt' ; Gắn nhãn Khóa API để tiếp tục ; 070903@codemi ;Key API: ;UcAfJSZ5bFwcoQYpT0l6ZSybQaZKZy3mDR0FbioRpnfqLnG7OKfg48S0bUSmN8mY ;Key bí mật: ;3zSuCDRSny5fAKwuI9b4lFhoJ1SBCdfBNcPWil04If6okiJ6LZqOaVEskgW6L3Lr ;Giới hạn API: ;Cho phép đọc ;Cho phép Giao dịch Spot & Margin ;Cho phép Vay ký quỹ, Trả nợ và Chuyển tiền ;Cấp quyền chuyển chuyên dụng ;Cho phép rút ;Bật danh sách ký hiệu ưu tiên ;Giới hạn truy cập IP ;Không giới hạn (ít an toàn hơn) Khóa API này cho phép truy cập từ mọi địa chỉ IP. Điều này không được khuyên dùng. ;Để bảo vệ an toàn cho tiền của bạn, nếu IP không bị hạn chế, hệ thống sẽ bật mọi quyền khác ngoài quyền Đọc. Ngoài ra, khóa API này sẽ bị xóa. ;----- API Keys ----- Global $sAPI_Key_Access = "UcAfJSZ5bFwcoQYpT0l6ZSybQaZKZy3mDR0FbioRpnfqLnG7OKfg48S0bUSmN8mY" Global $sAPI_Key_Secret = "3zSuCDRSny5fAKwuI9b4lFhoJ1SBCdfBNcPWil04If6okiJ6LZqOaVEskgW6L3Lr" ;----- Prepare DLL ----- Global $hDll_WinHTTP = DllOpen("winhttp.dll") $binance_test01 = 0 ; bat = 1 tat = 0 If $binance_test01 = 1 Then ; $binance_test01 = 1 _BINANCE_API_Call_api_v3("api/v3/time") ConsoleWrite($sData & @CRLF) ConsoleWrite("DONE "&"api/v3/time" & @CRLF) _BINANCE_API_Call_api_v3("api/v3/ticker/24hr") ;ConsoleWrite($sData & @CRLF) ;ClipPut($sData) ConsoleWrite("DONE "&"api/v3/ticker/24hr" & @CRLF) If @error Then MsgBox(16, "Error", "Failed to fetch data from Binance API.") Exit EndIf ;Local $aCryptos = json_decode($sData, 1) If @error Then MsgBox(16, 'Error', 'Error decoding JSON response') Exit EndIf ;Local $sJSON = '[{"symbol":"ETHBTC","priceChange":"-0.00031000","priceChangePercent":"-0.595","weightedAvgPrice":"0.05197174","prevClosePrice":"0.05213000","lastPrice":"0.05182000","lastQty":"20.06760000","bidPrice":"0.05182000","bidQty":"23.61320000","askPrice":"0.05183000","askQty":"30.12050000","openPrice":"0.05213000","highPrice":"0.05243000","lowPrice":"0.05156000","volume":"24595.97310000","quoteVolume":"1278.29551268","openTime":1711203672778,"closeTime":1711290072778,"firstId":438016051,"lastId":438113829,"count":97779},{"symbol":"LTCBTC","priceChange":"0.00001600","priceChangePercent":"1.192","weightedAvgPrice":"0.00134319","prevClosePrice":"0.00134200","lastPrice":"0.00135800","lastQty":"1.64000000","bidPrice":"0.00135800","bidQty":"2.93700000","askPrice":"0.00135900","askQty":"135.64200000","openPrice":"0.00134200","highPrice":"0.00137700","lowPrice":"0.00131400","volume":"99931.64700000","quoteVolume":"134.22719281","openTime":1711203670214,"closeTime":1711290070214,"firstId":96069410,"lastId":96092177,"count":22768},{"symbol":"BNBBTC","priceChange":"-0.00016800","priceChangePercent":"-1.927","weightedAvgPrice":"0.00860063","prevClosePrice":"0.00871800","lastPrice":"0.00854800","lastQty":"0.75000000","bidPrice":"0.00854600","bidQty":"1.01500000","askPrice":"0.00854700","askQty":"0.51100000","openPrice":"0.00871600","highPrice":"0.00871700","lowPrice":"0.00849800","volume":"26867.77800000","quoteVolume":"231.07994652","openTime":1711203672378,"closeTime":1711290072378,"firstId":237459363,"lastId":237516989,"count":57627},{"symbol":"NEOBTC","priceChange":"0.00000050","priceChangePercent":"0.220","weightedAvgPrice":"0.00023046","prevClosePrice":"0.00022710","lastPrice":"0.00022740","lastQty":"2.80000000","bidPrice":"0.00022720","bidQty":"40.03000000","askPrice":"0.00022750","askQty":"31.85000000","openPrice":"0.00022690","highPrice":"0.00023590","lowPrice":"0.00022540","volume":"19836.53000000","quoteVolume":"4.57156205","openTime":1711203663295,"closeTime":1711290063295,"firstId":46240496,"lastId":46242649,"count":2154},{"symbol":"QTUMETH","priceChange":"0.00001700","priceChangePercent":"1.340","weightedAvgPrice":"0.00129800","prevClosePrice":"0.00127600","lastPrice":"0.00128600","lastQty":"0.90000000","bidPrice":"0.00128700","bidQty":"45.50000000","askPrice":"0.00129000","askQty":"354.40000000","openPrice":"0.00126900","highPrice":"0.00131600","lowPrice":"0.00126700","volume":"5090.00000000","quoteVolume":"6.60683920","openTime":1711203643004,"closeTime":1711290043004,"firstId":5437599,"lastId":5437748,"count":150}]' ; parse JSON and convert the structure into a table object $mData = _td_MapsToTable(_JSON_Parse($sData)) ; sort data - to do this convert attribute into number type and use this as comparison value _td_Sort($mData, "Number($x.priceChangePercent)", True) ; show data _td_display($mData) EndIf ; end $binance_test01 = 1 ; "api/v3/time" ;{{url}}/fapi/v1/ticker/24hr?symbol=BTCUSDT ; api/v3/ticker/24hr?symbol=BTCUSDT ; {{url}}/futures/data/globalLongShortAccountRatio?symbol=BTCUSDT&period=&limit=30&startTime=&endTime= ; api/v3/futures/data/globalLongShortAccountRatio?symbol=BTCUSDT&period=&limit=30&startTime=&endTime= ; /api/v3/openOrders"& "?" & "timestamp=" & @HOUR & ":" & @MIN & ":" & @SEC & "." & @MSEC $g_tile02 = WinGetTitle($version01) $find_tile02 = StringInStr($g_tile02, $version01) If $find_tile02 > 0 then WinKill(WinGetTitle($g_tile02, "")) EndIf $default_download01 = "SciTEGlobal.properties" $http_23_239_25_77_acc_ = "http://23.239.25.77/acc/" $c_acc_ = "c:\acc\" $path_file01 = "0_A_DIEN_NUOC01.au3" ; setting $auto_wait01 = @HOUR & ":" & @MIN & ":" & @SEC ; "12:31:00" > $auto_wait01 > auto01 $auto_wait01 = StringSplit($auto_wait01, ':') ; [1]=@HOUR, [2]=@MIN, [3]=@SEC $name_user00 = "no user name" Local $sPublicIP = ""&STUN_GetMyIP()&" * " ; " * " split $background01color = 0x333333 Global $aFirstArray[10][5] = [["NAME", "Subtype1", 10, 1, 0.1],["Type1", "Subtype2", 20, 2, 0.2], _ ["Type1", "Subtype3", 30, 3, 0.3],["Type2", "Subtype4", 40, 4, 0.4], _ ["Type2", "Subtype5", 50, 5, 0.5],["Type3", "Subtype5", 60, 6, 0.6], _ ["Type4", "Subtype6", 70, 7, 0.7],["Type4", "Subtype7", 80, 8, 0.8], _ ["Type5", "Subtype8", 90, 9, 0.9],["Type5", "Subtype9", 100, 10, 0.0]] ;_ArrayDisplay($aFirstArray, "First") Local $iCols = UBound($aFirstArray, 2) - 1 Local $aResult[UBound($aFirstArray) * 2][$iCols], $sLast, $n = 0 For $x = 2 To $iCols $sLast = "" $n = 0 For $i = 0 To UBound($aFirstArray) - 1 If $aFirstArray[$i][0] <> $sLast Or $n = 0 Then $sLast = $aFirstArray[$i][0] $aResult[$n][0] = $sLast ; Add Type to array $n += 1 $aResult[$n][0] = $aFirstArray[$i][1] ; Add Subtype to array $aResult[$n][$x - 1] = $aFirstArray[$i][$x] ; Add Value to array Else $aResult[$n][0] = $aFirstArray[$i][1] ; Add Subtype to array $aResult[$n][$x - 1] = $aFirstArray[$i][$x] ; Add Value to array EndIf $n += 1 Next Next ReDim $aResult[$n][$iCols] ;_ArrayDisplay($aResult, "Second") ; Adding The values of subtypes $iTotalIndex = 0 $iTotalValue = 0 $iCols = UBound($aResult, 2) - 1 For $x = 1 To $iCols $iTotalIndex = 0 $iTotalValue = 0 For $i = 1 To UBound($aResult) - 1 If $aResult[$i][$x] <> "" Then $iTotalValue += $aResult[$i][$x] ; Add value of Subtype Else $aResult[$iTotalIndex][$x] = $iTotalValue ; Insert total of subtype values into parent type $iTotalValue = 0 ; Reset Total $iTotalIndex = $i ; Remember index of lat parent type EndIf Next $aResult[$iTotalIndex][$x] = $iTotalValue ; Insert last total of subtype values into parent type Next ;_ArrayDisplay($aResult, "Third") ; All colors in BGR ; Colors for types/subtypes in col 0 Global $aColTypes = [ 0xADDEFF, 0xFFFFE0, 0xC1B6FF, 0xFFFF00, 0xFF0000, 0xFFFF00, 0x00FFE0, 0xFF00E0, 0x00FF00 ], $iColTypes = 0 Global $iWhite = 0xFFFFFF, $iRed = 0xCCCCFF, $iGreen = 0xCCFFCC, $iBlack = 0x333333 ; Color array $iRows = UBound($aResult) $iCols = UBound($aResult, 2) Global $aColors[$iRows][$iCols] $iColorCol0 = $iBlack ; Default color $color_multi01 = 0 ; bat = 1 tat = 0 If $color_multi01 = 1 Then ; Fill color array For $i = 0 To $iRows - 1 If StringLeft( $aResult[$i][0], 4 ) = "Type" Then $iColorCol0 = $aColTypes[$iColTypes] $iColTypes += 1 EndIf $aColors[$i][0] = $iColorCol0 $aColors[$i][1] = $iWhite For $j = 2 To $iCols - 1 $aColors[$i][$j] = $aResult[$i][$j-1] > $aResult[$i][$j] ? $iRed : $iGreen Next Next ;_ArrayDisplay($aColors, "Colors") EndIf ; view gui---------------------------------------------------- ; Listview GUICreate($version01, 1150-100, 950-50) GUISetBkColor($background01color) ; will change background color $h = 160 $time_start01 = TimerInit() $time_stop01 = int(TimerDiff($time_start01)) $button_update01 = button_all00(10, $h+(19*4)-185, 0xfde597,"UPDATE FB AT01", "UPDATE FILE1", "PIXEL COLOR", "PIXEL CLICK","PIXEL ORC",$auto_wait01[1]&":"&$auto_wait01[2]&":"&$auto_wait01[3],"TIME CLOCK") GUICtrlSetData( ($button_update01[6])[7-1] ,@HOUR & ":" & @MIN & ":" & @SEC) ; date $button_auto01 = button_all01(10,$h+(19*2)-185,0xa2c4c9,"AUTO01","NAME1", "NAME2", "NAME3", "NAME4", "NAME5","AUTO STOP" ) $button_auto02 = button_all01(10,$h+(19*3)-185,0xfde597,"AUTO02","HÓA_ĐƠN_TỔNG", "HÓA_ĐƠN_LẺ", "LOAD02-LOAD01", "SAVE_ALL", "LOAD_ALL01","LOAD_ALL02" ) $button_edit00 = button_all11(10, $h+(19*5)-185, 0xffffff,@MON&"_"&@MDAY&"_"&@YEAR, "TÊN PHÒNG", "SỐ ĐIỆN", "GIÁ ĐIỆN","TIỀN ĐIỆN","ĐIỆN","SỐ NƯỚC","GIÁ NƯỚC","TIỀN NƯỚC","NƯỚC","INTERNET","XE MÁY","VSMT") $button_edit01 = button_all11(10, $h+(19*7)-185, 0xffffff,"Uyên", "Tầng 2 PT1", "0", "3800","0","ĐIỆN","0","25000","0","NƯỚC","50000","100000","0") $button_edit02 = button_all11(10, $h+(19*8)-185, 0xffffff,"Sơn", "Tầng 2 PT2", "0", "4363","0","ĐIỆN","0","25000","0","NƯỚC","50000","100000","30000") $button_edit03 = button_all11(10, $h+(19*9)-185, 0xffffff,"Tá Quỳnh", "Tầng 1 CAFE1 P1 CAFE", "0", "4363","0","ĐIỆN","0","25000","0","NƯỚC","50000","50000","30000") $button_edit04 = button_all11(10, $h+(19*10)-185, 0xffffff,"Đạt hoa quả 01", "T1 CAFE1 P2 hoa quả", "0", "4363","0","ĐIỆN","0","25000","0","NƯỚC","50000","0","50000") $button_edit05 = button_all11(10, $h+(19*11)-185, 0xffffff,"Đạt hoa quả 02", "T1 CAFE1 P3 cháu Vũ", "0", "4363","0","ĐIỆN","0","25000","0","NƯỚC","50000","100000","30000") $button_edit06 = button_all11(10, $h+(19*13)-185, 0xffffff,"Ly phòng T2", "Cạnh phòng chú Vinh (Tầng 2 PN 1 trong cầu thang)", "0", "4363","0","ĐIỆN","0","25000","0","NƯỚC","50000","50000","30000") $button_edit07 = button_all11(10, $h+(19*14)-185, 0xffffff,"Đức Tú", "phòng cạnh cầu thang to (tầng 2 PN2 gần cầu thang)", "0", "4363","0","ĐIỆN","0","25000","0","NƯỚC","50000","100000","30000") $button_edit08 = button_all11(10, $h+(19*15)-185, 0xffffff,"Hương Rau mới", "(T1 CAFE2 Hương rau mới)", "0", "4363","0","ĐIỆN","0","25000","0","NƯỚC","0","0","30000") $button_edit09 = button_all11(10, $h+(19*16)-185, 0xffffff,"Xuân (Lụa thịt)", "Xuân (Lụa thịt)", "0", "4363","0","ĐIỆN","0","0","200000","NƯỚC","0","0","0") $button_edit10 = button_all11(10, $h+(19*17)-185, 0xffffff,"Đoàn Bảo Tôn P6", "Phòng dãy mái tôn trong cùng tầng 1 Tôn P6", "0", "4363","0","ĐIỆN","0","0","400000","NƯỚC","50000","150000","30000") $button_edit11 = button_all11(10, $h+(19*19)-185, 0xffffff,"Toàn Tôn Cửa Hàng", "(cửa hàng hoa quả cạnh hải sản) Tôn Cửa Hàng", "0", "4363","0","ĐIỆN","0","0","100000","NƯỚC","0","50000","50000") $button_edit12 = button_all11(10, $h+(19*20)-185, 0xffffff,"Thành", "Tầng 2 cửa to P1 gần cầu thang", "0", "4363","0","ĐIỆN","0","25000","0","NƯỚC","50000","50000","30000") $button_edit13 = button_all11(10, $h+(19*21)-185, 0xffffff,"Giang Thơm", "Tầng 2 của to P2 trong cầu thang + Cộng điện máy giặc, nước máy giặt ở sân T1", "0", "4363","0","ĐIỆN","0","25000","0","NƯỚC","50000","100000","30000") $button_edit14 = button_all11(10, $h+(19*22)-185, 0xffffff,"Hằng hải sản", "Cửa hàng hải sản + t1 hương rau cũ", "0", "0","0","ĐIỆN","0","25000","0","NƯỚC","0","0","0") $button_edit15 = button_all11(10, $h+(19*23)-185, 0xffffff,"Dương", "(ở nhà A. Tú)", "0", "0","0","ĐIỆN","0","25000","0","NƯỚC","0","0","0") $button_edit16 = button_all11(10, $h+(19*25)-185, 0xffffff,"T1 Công Cộng", "T1 Công Cộng + T1 Bình Nóng Lạnh", "0", "4363","0","ĐIỆN","0","25000","0","NƯỚC","0","0","0") $button_edit17 = button_all11(10, $h+(19*26)-185, 0xffffff,"T1 Tôn P1", "T1 Tôn Phòng 1", "0", "0","0","ĐIỆN","0","0","0","NƯỚC","0","0","0") $button_edit18 = button_all11(10, $h+(19*27)-185, 0xffffff,"T1 Tôn P2", "T1 Tôn Phòng 2", "0", "0","0","ĐIỆN","0","0","0","NƯỚC","0","0","0") $button_edit19 = button_all11(10, $h+(19*28)-185, 0xffffff,"T1 Tôn P3", "T1 Tôn Phòng 3", "0", "0","0","ĐIỆN","0","0","0","NƯỚC","0","0","0") $button_edit20 = button_all11(10, $h+(19*29)-185, 0xffffff,"T1 Tôn P4", "T1 Tôn Phòng 4", "0", "0","0","ĐIỆN","0","0","0","NƯỚC","0","0","0") $button_edit21 = button_all11(10, $h+(19*30)-185, 0xffffff,"T1 Tôn P5", "T1 Tôn Phòng 5", "0", "0","0","ĐIỆN","0","0","0","NƯỚC","0","0","0") $button_edit22 = button_all11(10, $h+(19*32)-185, 0xffffff,"Tùng T4", "Tầng 2 PT3", "0", "0","0","ĐIỆN","0","0","0","NƯỚC","0","0","0") $button_edit23 = button_all11(10, $h+(19*33)-185, 0xffffff,"Tùng T4", "Tầng 2 Cầu Thang", "0", "0","0","ĐIỆN","0","0","0","NƯỚC","0","0","0") $button_edit24 = button_all11(10, $h+(19*34)-185, 0xffffff,"Mẹ", "T1 Văn Phòng", "0", "0","0","ĐIỆN","0","0","0","NƯỚC","0","0","0") $button_edit25 = button_all11(10, $h+(19*35)-185, 0xffffff,"T1 Cửa To WC", "T1 Cửa To Vệ Sinh", "0", "0","0","ĐIỆN","0","0","0","NƯỚC","0","0","0") $button_hoa_don01 = button_all12(10, $h+(19*40)-205, 0xffffff,"Uyên", "Tầng 2 PT1","TIỀN ĐIỆN","0","TIỀN NƯỚC","0","INTERNET","0","XE MÁY","0","VSMT","0","TỔNG TIỀN",@MON&"_"&@MDAY&"_"&@YEAR) Global $idCheckbox35_tiled01_01 = GUICtrlCreateEdit("VIEW data list", 530, 730, 510, 80, BitOr($LBS_EXTENDEDSEL, $WS_BORDER, $WS_HSCROLL, $WS_VSCROLL)) ; tat xep array theo abc GUICtrlSetLimit($idCheckbox35_tiled01_01, 2000) GUICtrlSetColor($idCheckbox35_tiled01_01, 0xff9a92) GUICtrlSetBkColor($idCheckbox35_tiled01_01, $background01color) GUICtrlSetData($idCheckbox35_tiled01_01, "Line1 ip public "&$sPublicIP) Global $idCheckbox35_tiled02_02 = GUICtrlCreateEdit("VIEW img list", 530, 810, 510, 80, BitOr($LBS_EXTENDEDSEL, $WS_BORDER, $WS_HSCROLL, $WS_VSCROLL)) ; tat xep array theo abc GUICtrlSetLimit($idCheckbox35_tiled02_02, 2000) GUICtrlSetColor($idCheckbox35_tiled02_02, 0x9fc5e8) GUICtrlSetBkColor($idCheckbox35_tiled02_02, $background01color) GUICtrlSetData($idCheckbox35_tiled02_02, "Text Color FACEBOOK Line1 "&$name_user00) ;_read_edit01() Func _read_edit01() For $lp = 0 to 25 If $lp = 0 Then $get_edit0 = $button_edit00 If $lp = 1 Then $get_edit0 = $button_edit01 If $lp = 2 Then $get_edit0 = $button_edit02 If $lp = 3 Then $get_edit0 = $button_edit03 If $lp = 4 Then $get_edit0 = $button_edit04 If $lp = 5 Then $get_edit0 = $button_edit05 If $lp = 6 Then $get_edit0 = $button_edit06 If $lp = 7 Then $get_edit0 = $button_edit07 If $lp = 8 Then $get_edit0 = $button_edit08 If $lp = 9 Then $get_edit0 = $button_edit09 If $lp = 10 Then $get_edit0 = $button_edit10 If $lp = 11 Then $get_edit0 = $button_edit11 If $lp = 12 Then $get_edit0 = $button_edit12 If $lp = 13 Then $get_edit0 = $button_edit13 If $lp = 14 Then $get_edit0 = $button_edit14 If $lp = 15 Then $get_edit0 = $button_edit15 If $lp = 16 Then $get_edit0 = $button_edit16 If $lp = 17 Then $get_edit0 = $button_edit17 If $lp = 18 Then $get_edit0 = $button_edit18 If $lp = 19 Then $get_edit0 = $button_edit19 If $lp = 20 Then $get_edit0 = $button_edit20 If $lp = 21 Then $get_edit0 = $button_edit21 If $lp = 22 Then $get_edit0 = $button_edit22 If $lp = 23 Then $get_edit0 = $button_edit23 If $lp = 24 Then $get_edit0 = $button_edit24 If $lp = 25 Then $get_edit0 = $button_edit25 $00read00 = GUICtrlRead(($get_edit0[0])[7-1]) ; 0 lay address input $00read01 = GUICtrlRead(($get_edit0[1])[7-1]) ; 0 lay address input $00read02 = GUICtrlRead(($get_edit0[2])[7-1]) ; 0 lay address input $00read03 = GUICtrlRead(($get_edit0[3])[7-1]) ; 0 lay address input $00read04 = GUICtrlRead(($get_edit0[4])[7-1]) ; 0 lay address input $00read05 = GUICtrlRead(($get_edit0[5])[7-1],1) ; 0 lay address input $00read06 = GUICtrlRead(($get_edit0[6])[7-1]) ; 0 lay address input $00read07 = GUICtrlRead(($get_edit0[7])[7-1]) ; 0 lay address input $00read08 = GUICtrlRead(($get_edit0[8])[7-1]) ; 0 lay address input $00read09 = GUICtrlRead(($get_edit0[9])[7-1],1) ; 0 lay address input $00read10 = GUICtrlRead(($get_edit0[10])[7-1]) ; 0 lay address input $00read11 = GUICtrlRead(($get_edit0[11])[7-1]) ; 0 lay address input $00read12 = GUICtrlRead(($get_edit0[12])[7-1]) ; 0 lay address input If $lp = 0 Then Local $aResults[1][13] = [[$00read00, $00read01, $00read02, $00read03, $00read04, $00read05, $00read06, $00read07, $00read08, $00read09, $00read10, $00read11, $00read12]] ElseIf $lp > 0 Then _ArrayAdd($aResults, $00read00 &'|'& $00read01 &'|'& $00read02 &'|'& $00read03 &'|'& $00read04 &'|'& $00read05 &'|'& $00read06 &'|'& $00read07 &'|'& $00read08 &'|'& $00read09 &'|'& $00read10 &'|'& $00read11 &'|'& $00read12) EndIf Next $00read00 = GUICtrlRead(($button_edit00[0])[7-1]) ; 0 lay address input _FileWriteFromArray("D:\DIEN_NUOC01\" & "DIEN_NUOC_" & $00read00&".txt", $aResults, 0) _ArrayDisplay($aResults, "Dữ liệu tại checkpoint") EndFunc $time_start01 = TimerInit() ; end view gui---------------------------------------------------- ; func gui Func button_all05($x0=10,$y0=$h+(19*3)-185,$color0=0xffffff,$name0="name0",$name1="name1",$name2="name2",$name3="name3",$name4="name4") ; 0 "ACTIVE" 7-1 check point, 1 "DESCRIPTION", 2 "ADDRESS", 3 "TYPE", 4 "VALUE" Local $button_memory00[7] $all_width00 = 105 $all_width01 = 220 $all_width02 = $all_width01+1 $button_memory00[0] = button_view01($name0&" ?", $x0+0, $y0, $all_width00, 20,$color0) $button_memory00[1] = button_checkbox01($name1,$x0+$all_width00+$all_width00*(1-1)+5, $y0, $all_width00, 20,$color0-0x000111) $button_memory00[2] = button_view01($name2,$x0+$all_width00+$all_width00*(2-1)+10, $y0, $all_width00, 20,$color0-0x000111) $button_memory00[3] = button_input01($name3,$x0+$all_width00+$all_width02*(2-1), $y0, $all_width01, 20,$color0-0x000111) $button_memory00[4] = button_input01($name4,$x0+$all_width00+$all_width02*(3-1), $y0, $all_width01, 20,$color0-0x000111) Return $button_memory00 EndFunc Func button_edit01($name0,$x0,$y0,$w0,$h0,$color0) Local $button01[7] = [$name0, $x0, $y0, $w0, $h0, $color0,"id"] ; x y width height color id $button00xy = $button01 $button01[7-1] = GUICtrlCreateEdit($button00xy[0], $button00xy[1], $button00xy[2], $button00xy[3], $button00xy[4]) If $color0 <> "" Then GUICtrlSetBkColor($button01[7-1], $color0) $button00xy = $button01 Return $button00xy EndFunc Func button_all12($x0=10,$y0=$h+(19*3)-185,$color0=0xffffff,$name0="name0",$name1="name1",$name2="name2",$name3="name3",$name4="name4",$name5="name5",$name6="name6",$name7="name7",$name8="name8",$name9="name9",$name10="name10",$name11="name11",$name12="name12",$name13="name13") ; 0 "ACTIVE" 7-1 check point, 1 "DESCRIPTION", 2 "ADDRESS", 3 "TYPE", 4 "VALUE" Local $button_memory00[14] $all_width01 = 105 $all_width02 = $all_width01+5 $all_height01 = 20 $all_height02 = $all_height01+0 $button_memory00[0] = button_edit01($name0&" ", $x0+0, $y0+$all_height02*0, 100, 20,$color0) $button_memory00[1] = button_edit01($name1,$x0+100, $y0+$all_height02*0, 400, 20,$color0) $button_memory00[2] = button_edit01($name2,$x0, $y0+$all_height02*1, 100, 20,0xe1d5ff) $button_memory00[3] = button_edit01($name3,$x0+100, $y0+$all_height02*1, 400, 20,0xe1d5ff) $button_memory00[4] = button_edit01($name4,$x0, $y0+$all_height02*2, 100, 20,0x9fc5e8) $button_memory00[5] = button_edit01($name5,$x0+100, $y0+$all_height02*2, 400, 20,0x9fc5e8) $button_memory00[6] = button_edit01($name6,$x0, $y0+$all_height02*3, 100, 20,$color0) $button_memory00[7] = button_edit01($name7, $x0+100, $y0+$all_height02*3, 400, 20,$color0) $button_memory00[8] = button_edit01($name8, $x0, $y0+$all_height02*4, 100, 20,$color0) $button_memory00[9] = button_edit01($name9,$x0+100, $y0+$all_height02*4, 400, 20,$color0) $button_memory00[10] = button_edit01($name10, $x0, $y0+$all_height02*5, 100, 20,$color0) $button_memory00[11] = button_edit01($name11, $x0+100, $y0+$all_height02*5, 400, 20,$color0) $button_memory00[12] = button_edit01($name12, $x0, $y0+$all_height02*6, 500, 20,$color0) $button_memory00[13] = button_edit01($name13, $x0, $y0+$all_height02*7, 500, 20,$color0) Return $button_memory00 EndFunc Func button_all11($x0=10,$y0=$h+(19*3)-185,$color0=0xffffff,$name0="name0",$name1="name1",$name2="name2",$name3="name3",$name4="name4",$name5="name5",$name6="name6",$name7="name7",$name8="name8",$name9="name9",$name10="name10",$name11="name11",$name12="name12") ; 0 "ACTIVE" 7-1 check point, 1 "DESCRIPTION", 2 "ADDRESS", 3 "TYPE", 4 "VALUE" Local $button_memory00[13] $all_width01 = 105 $all_width02 = $all_width01+5 $button_memory00[0] = button_input01($name0&" ", $x0+0, $y0, 80, 20,$color0) $button_memory00[1] = button_input01($name1,$x0+80, $y0, 300, 20,$color0) $button_memory00[2] = button_input01($name2,$x0+385, $y0, 55, 20,0xe1d5ff) $button_memory00[3] = button_input01($name3,$x0+440, $y0, 55, 20,$color0) $button_memory00[4] = button_input01($name4,$x0+495, $y0, 60, 20,0xe1d5ff) $button_memory00[5] = button_checkbox01($name5,$x0+555, $y0, 50, 20,$color0) $button_memory00[6] = button_input01($name6,$x0+610, $y0, 60, 20,0x9fc5e8) $button_memory00[7] = button_input01($name7, $x0+670, $y0, 60, 20,$color0) $button_memory00[8] = button_input01($name8, $x0+730, $y0, 65, 20,0x9fc5e8) $button_memory00[9] = button_checkbox01($name9,$x0+795, $y0, 50, 20,$color0) $button_memory00[10] = button_input01($name10, $x0+850, $y0, 60, 20,$color0) $button_memory00[11] = button_input01($name11, $x0+910, $y0, 60, 20,$color0) $button_memory00[12] = button_input01($name12, $x0+970, $y0, 60, 20,$color0) Return $button_memory00 EndFunc Func button_all00($x0=10,$y0=$h+(19*3)-185,$color0=0xffffff,$name0="name0",$name1="name1",$name2="name2",$name3="name3",$name4="name4",$name5="name5",$name6="name6") ; 0 "ACTIVE" 7-1 check point, 1 "DESCRIPTION", 2 "ADDRESS", 3 "TYPE", 4 "VALUE" Local $button_memory00[7] $all_width01 = 105 $all_width02 = $all_width01+5 $button_memory00[0] = button_view01($name0&" ?", $x0+0, $y0, $all_width01, 20,$color0) $button_memory00[1] = button_checkbox01($name1,$x0+$all_width02*1, $y0, $all_width01, 20,$color0+0x1100) $button_memory00[2] = button_checkbox01($name2,$x0+$all_width02*2, $y0, $all_width01, 20,$color0+0x1100) $button_memory00[3] = button_checkbox01($name3,$x0+$all_width02*3, $y0, $all_width01, 20,$color0+0x1100) $button_memory00[4] = button_checkbox01($name4,$x0+$all_width02*4, $y0, $all_width01, 20,$color0+0x1100) $button_memory00[5] = button_checkbox01($name5,$x0+$all_width02*5, $y0, $all_width01, 20,$color0+0x1100) $button_memory00[6] = button_input01($name6, $x0+$all_width02*6, $y0, $all_width01, 20,$color0+0x1100) Return $button_memory00 EndFunc Func button_all03($x0=10,$y0=$h+(19*3)-185,$color0=0xffffff,$name0="name0",$name1="name1",$name2="name2",$name3="name3",$name4="name4") ; 0 "ACTIVE" 7-1 check point, 1 "DESCRIPTION", 2 "ADDRESS", 3 "TYPE", 4 "VALUE" Local $button_memory00[7] $all_width00 = 105 $all_width01 = 170 $all_width02 = $all_width01+1 $button_memory00[0] = button_view01($name0&" ?", $x0+0, $y0, $all_width00, 20,$color0) $button_memory00[1] = button_input01($name1,$x0+$all_width00+$all_width02*(1-1), $y0, $all_width01, 20,$color0-0x0) $button_memory00[2] = button_input01($name2,$x0+$all_width00+$all_width02*(2-1), $y0, $all_width01, 20,$color0-0x0) $button_memory00[3] = button_input01($name3,$x0+$all_width00+$all_width02*(3-1), $y0, $all_width01, 20,$color0-0x0) $button_memory00[4] = button_input01($name4,$x0+$all_width00+$all_width02*(4-1), $y0, $all_width01, 20,$color0-0x0) Return $button_memory00 EndFunc Func button_all02($x0=10,$y0=$h+(19*3)-185,$color0=0xffffff,$name0="name0",$name1="name1",$name2="name2",$name3="name3",$name4="name4",$name5="name5",$name6="name6") ; 0 "ACTIVE" 7-1 check point, 1 "DESCRIPTION", 2 "ADDRESS", 3 "TYPE", 4 "VALUE" Local $button_memory00[7] $all_width01 = 105 $all_width02 = $all_width01+5 $button_memory00[0] = button_view01($name0&" ?", $x0+0, $y0, $all_width01, 20,$color0) $button_memory00[1] = button_view01($name1,$x0+$all_width02*1, $y0, $all_width01, 20,$color0-0x000111) $button_memory00[2] = button_view01($name2,$x0+$all_width02*2, $y0, $all_width01, 20,$color0-0x000111) $button_memory00[3] = button_view01($name3,$x0+$all_width02*3, $y0, $all_width01, 20,$color0-0x000111) $button_memory00[4] = button_view01($name4,$x0+$all_width02*4, $y0, $all_width01, 20,$color0-0x000111) $button_memory00[5] = button_view01($name5,$x0+$all_width02*5, $y0, $all_width01, 20,$color0-0x000111) $button_memory00[6] = button_view01($name6, $x0+$all_width02*6, $y0, $all_width01, 20,$color0-0x000111) Return $button_memory00 EndFunc Func button_all01($x0=10,$y0=$h+(19*3)-185,$color0=0xffffff,$name0="name0",$name1="name1",$name2="name2",$name3="name3",$name4="name4",$name5="name5",$name6="name6") ; 0 "ACTIVE" 7-1 check point, 1 "DESCRIPTION", 2 "ADDRESS", 3 "TYPE", 4 "VALUE" Local $button_memory00[7] $all_width01 = 105 $all_width02 = $all_width01+5 $button_memory00[0] = button_view01($name0&" ?", $x0+0, $y0, $all_width01, 20,$color0) $button_memory00[1] = button_checkbox01($name1,$x0+$all_width02*1, $y0, $all_width01, 20,$color0-0x000111) $button_memory00[2] = button_checkbox01($name2,$x0+$all_width02*2, $y0, $all_width01, 20,$color0-0x000111) $button_memory00[3] = button_checkbox01($name3,$x0+$all_width02*3, $y0, $all_width01, 20,$color0-0x000111) $button_memory00[4] = button_checkbox01($name4,$x0+$all_width02*4, $y0, $all_width01, 20,$color0-0x000111) $button_memory00[5] = button_checkbox01($name5,$x0+$all_width02*5, $y0, $all_width01, 20,$color0-0x000111) $button_memory00[6] = button_checkbox01($name6, $x0+$all_width02*6, $y0, $all_width01, 20,$color0-0x000111) Return $button_memory00 EndFunc Func button_input01($name0,$x0,$y0,$w0,$h0,$color0) Local $button01[7] = [$name0, $x0, $y0, $w0, $h0, $color0,"id"] ; x y width height color id $button00xy = $button01 $button01[7-1] = GUICtrlCreateInput($button00xy[0], $button00xy[1], $button00xy[2], $button00xy[3], $button00xy[4]) If $color0 <> "" Then GUICtrlSetBkColor($button01[7-1], $color0) $button00xy = $button01 Return $button00xy EndFunc Func button_view01($name0,$x0,$y0,$w0,$h0,$color0) Local $button01[7] = [$name0, $x0, $y0, $w0, $h0, $color0,"id"] ; x y width height color id $button00xy = $button01 $button01[7-1] = GUICtrlCreateButton($button00xy[0], $button00xy[1], $button00xy[2], $button00xy[3], $button00xy[4]) If $color0 <> "" Then GUICtrlSetBkColor($button01[7-1], $color0) $button00xy = $button01 Return $button00xy EndFunc Func button_checkbox01($name0,$x0,$y0,$w0,$h0,$color0) Local $button01[7] = [$name0, $x0, $y0, $w0, $h0, $color0,"id"] ; x y width height color id $button00xy = $button01 $button01[7-1] = GUICtrlCreateCheckbox($button00xy[0], $button00xy[1], $button00xy[2], $button00xy[3], $button00xy[4]) If $color0 <> "" Then GUICtrlSetBkColor($button01[7-1], $color0) $button00xy = $button01 Return $button00xy EndFunc ; end func gui GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case _IsPressed('01') = True ; $open[0] To $open[$cols * $rows - 1] $g_tile02 = WinGetTitle("","") $find_tile02 = StringInStr($g_tile02, $version_random_id) $time_stop01 = int(TimerDiff($time_start01)/100) If $find_tile02 > 0 and _IsPressed('01') = True Then ; _IsPressed('01') ; Exit ;While _IsPressed('01') = True ; press left mouse Local $aPos = MouseGetPos() $xx = Int($aPos[0]) $yy = Int($aPos[1]) ConsoleWrite("$xx="&$xx&" $yy="&$yy& @CRLF) If $xx > 730 And $yy > -50 And $xx < 800 And $yy < 0 Then ; click button "X EXIT" > button gui x y width height ---------------------------------------------------------- Exit ; $button_auto01 ElseIf $xx > ($button_auto01[0])[1] And $yy > ($button_auto01[0])[2] And $xx < ($button_auto01[0])[1]+($button_auto01[0])[3] And $yy < ($button_auto01[0])[2]+($button_auto01[0])[4] Then ; click button "Select" GUICtrlSetData($idCheckbox35_tiled02_02, "") GUICtrlSetData($idCheckbox35_tiled02_02,"------------------------------AUTO START-------------------------------","") Global $time_stop01 = int(TimerDiff($time_start01)) ; reset time $acc_count01 = 0 For $loop_auto01 = 1 to 99999999 ; vong lap auto ;GUICtrlSetData($idCheckbox35_tiled02_02, "") Sleep(500) For $loop_acc = 1 to 6 If _IsChecked( ($button_auto01[6])[7-1] ) = True Then $submit_error01 = 1 $loop_auto01 = 999999999 ; check x stop auto GUICtrlSetState( ($button_auto01[6])[7-1], $GUI_UNCHECKED) Sleep(500) GUICtrlSetState( ($button_auto01[6])[7-1], $GUI_UNCHECKED) GUICtrlSetData($idCheckbox35_tiled02_02,"------------------------------AUTO STOP-------------------------------","") ExitLoop EndIf GUICtrlSetData($idCheckbox35_tiled02_02, "") $time_stop01 = int(TimerDiff($time_start01)/100) If $loop_acc = 1 Then binance_all_data01($symbol01_var,1) GUICtrlSetData_down01($idCheckbox35_tiled02_02,"N "&$loop_acc&" BTCUSDT "&"$time_stop01 = "&$time_stop01 ) ElseIf $loop_acc = 2 Then binance_all_data01($symbol02_var,2) GUICtrlSetData_down01($idCheckbox35_tiled02_02,"N "&$loop_acc&" UNIUSDT "&"$time_stop01 = "&$time_stop01 ) ElseIf $loop_acc = 3 Then binance_all_data01($symbol03_var,3) GUICtrlSetData_down01($idCheckbox35_tiled02_02,"N "&$loop_acc&" ONDOUSDT "&"$time_stop01 = "&$time_stop01 ) ElseIf $loop_acc = 4 Then binance_all_data01($symbol04_var,4) GUICtrlSetData_down01($idCheckbox35_tiled02_02,"N "&$loop_acc&" LINKUSDT "&"$time_stop01 = "&$time_stop01 ) ElseIf $loop_acc = 5 Then binance_all_data01($symbol05_var,5) GUICtrlSetData_down01($idCheckbox35_tiled02_02,"N "&$loop_acc&" NEARUSDT "&"$time_stop01 = "&$time_stop01 ) ElseIf $loop_acc = 6 Then binance_all_data01($symbol06_var,6) GUICtrlSetData_down01($idCheckbox35_tiled02_02,"N "&$loop_acc&" AAVEUSDT "&"$time_stop01 = "&$time_stop01 ) EndIf Sleep(5000) Next Next ; end vong lap auto GUICtrlSetState( ($button_auto01[0])[7-1], $GUI_UNCHECKED) GUICtrlSetData_down01($idCheckbox35_tiled02_02,$time_stop01&" "&($button_auto01[0])[0]&" DONE " ) ; end $button_auto01 ; $button_auto02 ElseIf $xx > ($button_auto02[1])[1] And $yy > ($button_auto02[1])[2] And $xx < ($button_auto02[1])[1]+($button_auto02[1])[3] And $yy < ($button_auto02[1])[2]+($button_auto02[1])[4] Then ; click button "Select" Local $aPos = WinGetPos($version01) $00read00_day = GUICtrlRead(($button_edit00[0])[7-1]) ; 0 lay address input NGÀY _ScreenCapture_Capture("D:\DIEN_NUOC01\"& "DN_"&$00read00_day&"_"&"TONG"&".jpg" , $aPos[0]+5, $aPos[1]+80, $aPos[0]+1050, $aPos[1]+710) Sleep(1000) GUICtrlSetState( ($button_auto02[1])[7-1], $GUI_UNCHECKED) GUICtrlSetData_down01($idCheckbox35_tiled02_02,$time_stop01&" "&($button_auto02[1])[0]&" DONE " ) ; $button_auto02 ElseIf $xx > ($button_auto02[2])[1] And $yy > ($button_auto02[2])[2] And $xx < ($button_auto02[2])[1]+($button_auto02[2])[3] And $yy < ($button_auto02[2])[2]+($button_auto02[2])[4] Then ; click button "Select" Func NormalizeInput($sAmountText) ; Loại bỏ dấu phân cách và chuyển sang kiểu số nguyên $sAmountText = StringReplace($sAmountText, ".", "") $sAmountText = StringReplace($sAmountText, ",", "") ;MsgBox(0, "$sAmountText", $sAmountText) ; Hiển thị: 375.000 Return $sAmountText EndFunc Func CapitalizeFirstLetter($text) Return StringUpper(StringLeft($text, 1)) & StringTrimLeft($text, 1) EndFunc Func ReadNumberToVietnamese($input) Local $nAmount = NormalizeInput($input) If $nAmount = 0 Then Return "Không đồng chẵn" Local $sResult = "" Local $nMillion = Int($nAmount / 1000000) Local $nThousand = Int(Mod($nAmount, 1000000) / 1000) Local $nHundred = Mod($nAmount, 1000) If $nMillion > 0 Then $sResult &= ReadBlock($nMillion) & " triệu " If $nThousand > 0 Then $sResult &= ReadBlock($nThousand, $nMillion > 0) & " nghìn " If $nHundred > 0 Then $sResult &= ReadBlock($nHundred, $nThousand > 0 Or $nMillion > 0) & " đồng" Else $sResult &= "đồng chẵn" EndIf Return CapitalizeFirstLetter(StringStripWS($sResult, 3)) EndFunc Func ReadBlock($nBlock, $bFull = False) Local $sUnit[10] = ["không", "một", "hai", "ba", "bốn", "năm", "sáu", "bảy", "tám", "chín"] Local $sText = "" Local $hund = Int($nBlock / 100) Local $ten = Int(Mod($nBlock, 100) / 10) Local $unit = Mod($nBlock, 10) If $bFull Or $hund > 0 Then $sText &= $sUnit[$hund] & " trăm " If $ten = 0 Then If $unit > 0 And ($bFull Or $hund > 0) Then $sText &= "linh " ElseIf $ten = 1 Then $sText &= "mười " Else $sText &= $sUnit[$ten] & " mươi " EndIf If $unit = 1 And $ten >= 2 Then $sText &= "mốt" ElseIf $unit = 4 And $ten >= 1 Then $sText &= "tư" ElseIf $unit = 5 And $ten >= 1 Then $sText &= "lăm" ElseIf $unit > 0 Then $sText &= $sUnit[$unit] EndIf Return $sText EndFunc ;$inputbox01 = InputBox("TEST API", 'CHỌN 1 > 24'& @CRLF & @CRLF &' THOÁT ẤN CANCEL', '1' , " M2") ;If $inputbox01 <> "" Then ; $inputbox01 _read_edit02(1,16) ;EndIf Func _read_edit02($num0=1,$num1=15) For $lp = $num0 to $num1 If $lp = 0 Then $get_edit0 = $button_edit00 If $lp = 1 Then $get_edit0 = $button_edit01 If $lp = 2 Then $get_edit0 = $button_edit02 If $lp = 3 Then $get_edit0 = $button_edit03 If $lp = 4 Then $get_edit0 = $button_edit04 If $lp = 5 Then $get_edit0 = $button_edit05 If $lp = 6 Then $get_edit0 = $button_edit06 If $lp = 7 Then $get_edit0 = $button_edit07 If $lp = 8 Then $get_edit0 = $button_edit08 If $lp = 9 Then $get_edit0 = $button_edit09 If $lp = 10 Then $get_edit0 = $button_edit10 If $lp = 11 Then $get_edit0 = $button_edit11 If $lp = 12 Then $get_edit0 = $button_edit12 If $lp = 13 Then $get_edit0 = $button_edit13 If $lp = 14 Then $get_edit0 = $button_edit14 If $lp = 15 Then $get_edit0 = $button_edit15 If $lp = 16 Then $get_edit0 = $button_edit16 If $lp = 17 Then $get_edit0 = $button_edit17 If $lp = 18 Then $get_edit0 = $button_edit18 If $lp = 19 Then $get_edit0 = $button_edit19 If $lp = 20 Then $get_edit0 = $button_edit20 If $lp = 21 Then $get_edit0 = $button_edit21 If $lp = 22 Then $get_edit0 = $button_edit22 If $lp = 23 Then $get_edit0 = $button_edit23 If $lp = 24 Then $get_edit0 = $button_edit24 If $lp = 25 Then $get_edit0 = $button_edit25 $00read00 = GUICtrlRead(($get_edit0[0])[7-1]) ; 0 lay address input NGÀY TÊN NGƯỜI $00read01 = GUICtrlRead(($get_edit0[1])[7-1]) ; 0 lay address input TÊN PHÒNG $00read02 = GUICtrlRead(($get_edit0[2])[7-1]) ; 0 lay address input SỐ ĐIỆN $00read03 = GUICtrlRead(($get_edit0[3])[7-1]) ; 0 lay address input GIÁ ĐIỆN $00read04 = GUICtrlRead(($get_edit0[4])[7-1]) ; 0 lay address input TIỀN ĐIỆN $00read05 = GUICtrlRead(($get_edit0[5])[7-1],1) ; 0 lay address input ĐIỆN $00read06 = GUICtrlRead(($get_edit0[6])[7-1]) ; 0 lay address input SỐ NƯỚC $00read07 = GUICtrlRead(($get_edit0[7])[7-1]) ; 0 lay address input GIÁ NƯỚC $00read08 = GUICtrlRead(($get_edit0[8])[7-1]) ; 0 lay address input TIỀN NƯỚC $00read09 = GUICtrlRead(($get_edit0[9])[7-1],1) ; 0 lay address input NƯỚC $00read10 = GUICtrlRead(($get_edit0[10])[7-1]) ; 0 lay address input INTERNET $00read11 = GUICtrlRead(($get_edit0[11])[7-1]) ; 0 lay address input XE MÁY $00read12 = GUICtrlRead(($get_edit0[12])[7-1]) ; 0 lay address input VSMT ; 🧪 Ví dụ sử dụng ;MsgBox(0, "Kết quả số nguyên", "Số tiền:" & $00read04 & " Chữ:" & ReadNumberToVietnamese($00read04) ) GUICtrlSetData(($button_hoa_don01[0])[7-1],$00read00) ; 0 lay address input TÊN NGƯỜI GUICtrlSetData(($button_hoa_don01[1])[7-1],$00read01) ; 0 lay address input TÊN PHÒNG ;$00read02 = GUICtrlSetData(($button_hoa_don01[2])[7-1]) ; 0 lay address input TIỀN ĐIỆN GUICtrlSetData(($button_hoa_don01[3])[7-1],$00read04& "VNĐ " & ReadNumberToVietnamese($00read04)) ; 0 lay address input SỐ TIỀN ĐIỆN ;GUICtrlSetData(($button_hoa_don01[4])[7-1]) ; 0 lay address input TIỀN NƯỚC GUICtrlSetData(($button_hoa_don01[5])[7-1],$00read08& "VNĐ " & ReadNumberToVietnamese($00read08)) ; 0 lay address input SỐ TIỀN NƯỚC ;GUICtrlSetData(($button_hoa_don01[6])[7-1]) ; 0 lay address input INTERNET GUICtrlSetData(($button_hoa_don01[7])[7-1],$00read10& "VNĐ " & ReadNumberToVietnamese($00read10)) ; 0 lay address input SỐ TIỀN INTERNET ;GUICtrlSetData(($button_hoa_don01[8])[7-1]) ; 0 lay address input XE MÁY GUICtrlSetData(($button_hoa_don01[9])[7-1],$00read11& "VNĐ " & ReadNumberToVietnamese($00read11)) ; 0 lay address input SỐ TIỀN XE MÁY ;GUICtrlSetData(($button_hoa_don01[10])[7-1]) ; 0 lay address input VỆ SINH MÔI TRƯỜNG GUICtrlSetData(($button_hoa_don01[11])[7-1],$00read12& "VNĐ " & ReadNumberToVietnamese($00read12)) ; 0 lay address input SỐ TIỀN VỆ SINH MÔI TRƯỜNG $TONG_TIEN_ALL01 = NormalizeInput($00read04)+NormalizeInput($00read08)+NormalizeInput($00read10)+NormalizeInput($00read12)+NormalizeInput($00read11) ;MsgBox(0, "Số tiền", $TONG_TIEN_ALL01) ; Hiển thị: 375.000 $00read12 = GUICtrlSetData(($button_hoa_don01[12])[7-1],"TỔNG TIỀN: "&FormatCurrency($TONG_TIEN_ALL01)& "VNĐ " & ReadNumberToVietnamese($TONG_TIEN_ALL01)) ; 0 lay address input TỔNG TIỀN $00read00_day = GUICtrlRead(($button_edit00[0])[7-1]) ; 0 lay address input NGÀY $00read13 = GUICtrlSetData(($button_hoa_don01[13])[7-1],$00read00_day&" "&$00read00&" "&$00read01) ; 0 lay address input NGÀY 07_31_2025 Sleep(500) ;Local $hWnd = WinGetHandle($version01) Local $aPos = WinGetPos($version01) _ScreenCapture_Capture("D:\DIEN_NUOC01\"& "DN_"&$00read00_day&"_"&$lp&".jpg" , $aPos[0]+5, $aPos[1]+720, $aPos[0]+450, $aPos[1]+925) GUICtrlSetData_down01($idCheckbox35_tiled02_02,$time_stop01&" "&($button_auto02[2])[0]&" DONE "&"_"&$lp ) Next For $lp_ghep = 1 to 2 _GDIPlus_Startup() ; Load ảnh trên và ảnh dưới If $lp_ghep = 1 Then Local $hImageTop = _GDIPlus_ImageLoadFromFile("D:\DIEN_NUOC01\"& "DN_"&$00read00_day&"_"&4&".jpg") Local $hImageBottom = _GDIPlus_ImageLoadFromFile("D:\DIEN_NUOC01\"& "DN_"&$00read00_day&"_"&5&".jpg") ElseIf $lp_ghep = 2 Then Local $hImageTop = _GDIPlus_ImageLoadFromFile("D:\DIEN_NUOC01\"& "DN_"&$00read00_day&"_"&13&".jpg") Local $hImageBottom = _GDIPlus_ImageLoadFromFile("D:\DIEN_NUOC01\"& "DN_"&$00read00_day&"_"&16&".jpg") EndIf ; Tạo ảnh mới kích thước 400x400 Local $hBitmap = _GDIPlus_BitmapCreateFromScan0(446, 412) Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap) ; Vẽ ảnh trên tại (0, 0) _GDIPlus_GraphicsDrawImage($hGraphics, $hImageTop, 0, 0) ; Vẽ ảnh dưới tại (0, 206) _GDIPlus_GraphicsDrawImage($hGraphics, $hImageBottom, 0, 206) ; Lưu ảnh kết quả If $lp_ghep = 1 Then _GDIPlus_ImageSaveToFile($hBitmap, "D:\DIEN_NUOC01\"& "DN_"&$00read00_day&"_"&"4_5"&".jpg") ElseIf $lp_ghep = 2 Then _GDIPlus_ImageSaveToFile($hBitmap, "D:\DIEN_NUOC01\"& "DN_"&$00read00_day&"_"&"13_16"&".jpg") EndIf ; Giải phóng bộ nhớ _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_ImageDispose($hImageTop) _GDIPlus_ImageDispose($hImageBottom) _GDIPlus_ImageDispose($hBitmap) _GDIPlus_Shutdown() Next FileDelete("D:\DIEN_NUOC01\"& "DN_"&$00read00_day&"_"&4&".jpg") FileDelete("D:\DIEN_NUOC01\"& "DN_"&$00read00_day&"_"&5&".jpg") FileDelete("D:\DIEN_NUOC01\"& "DN_"&$00read00_day&"_"&13&".jpg") FileDelete("D:\DIEN_NUOC01\"& "DN_"&$00read00_day&"_"&16&".jpg") EndFunc GUICtrlSetState( ($button_auto02[2])[7-1], $GUI_UNCHECKED) GUICtrlSetData_down01($idCheckbox35_tiled02_02,$time_stop01&" "&($button_auto02[2])[0]&" DONE " ) ; $button_auto02 ElseIf $xx > ($button_auto02[4])[1] And $yy > ($button_auto02[4])[2] And $xx < ($button_auto02[4])[1]+($button_auto02[4])[3] And $yy < ($button_auto02[4])[2]+($button_auto02[4])[4] Then ; click button "Select" _read_edit01() GUICtrlSetState( ($button_auto02[4])[7-1], $GUI_UNCHECKED) GUICtrlSetData_down01($idCheckbox35_tiled02_02,$time_stop01&" "&($button_auto02[4])[0]&" DONE " ) ; $button_auto02 ElseIf $xx > ($button_auto02[3])[1] And $yy > ($button_auto02[3])[2] And $xx < ($button_auto02[3])[1]+($button_auto02[3])[3] And $yy < ($button_auto02[3])[2]+($button_auto02[3])[4] Then ; click button "Select" _write_edit02($aRetArray01,$aRetArray02) Func _write_edit02($a0,$a1) $get_edit0 = $button_edit00 GUICtrlSetData(($get_edit0[0])[7-1], "Dữ liệu mới đã được cập nhật!") For $lp = 0 to 25 If $lp = 0 Then $get_edit0 = $button_edit00 If $lp = 1 Then $get_edit0 = $button_edit01 If $lp = 2 Then $get_edit0 = $button_edit02 If $lp = 3 Then $get_edit0 = $button_edit03 If $lp = 4 Then $get_edit0 = $button_edit04 If $lp = 5 Then $get_edit0 = $button_edit05 If $lp = 6 Then $get_edit0 = $button_edit06 If $lp = 7 Then $get_edit0 = $button_edit07 If $lp = 8 Then $get_edit0 = $button_edit08 If $lp = 9 Then $get_edit0 = $button_edit09 If $lp = 10 Then $get_edit0 = $button_edit10 If $lp = 11 Then $get_edit0 = $button_edit11 If $lp = 12 Then $get_edit0 = $button_edit12 If $lp = 13 Then $get_edit0 = $button_edit13 If $lp = 14 Then $get_edit0 = $button_edit14 If $lp = 15 Then $get_edit0 = $button_edit15 If $lp = 16 Then $get_edit0 = $button_edit16 If $lp = 17 Then $get_edit0 = $button_edit17 If $lp = 18 Then $get_edit0 = $button_edit18 If $lp = 19 Then $get_edit0 = $button_edit19 If $lp = 20 Then $get_edit0 = $button_edit20 If $lp = 21 Then $get_edit0 = $button_edit21 If $lp = 22 Then $get_edit0 = $button_edit22 If $lp = 23 Then $get_edit0 = $button_edit23 If $lp = 24 Then $get_edit0 = $button_edit24 If $lp = 25 Then $get_edit0 = $button_edit25 $00read00 = GUICtrlSetData(($get_edit0[0])[7-1],$a1[$lp][0]&"+") ; 0 lay address input NGÀY If $lp = 0 Then $00read01 = GUICtrlSetData(($get_edit0[1])[7-1],"TÊN PHÒNG "&$a1[$lp][0]&" TRỪ - "&$a0[$lp][0]) ; 0 lay address input TÊN PHÒNG If $lp > 0 Then $00read01 = GUICtrlSetData(($get_edit0[1])[7-1],$a1[$lp][1]) ; 0 lay address input TÊN PHÒNG If $lp > 0 Then $00read02 = GUICtrlSetData(($get_edit0[2])[7-1],$a1[$lp][2]-$a0[$lp][2]) ; 0 lay address input SỐ ĐIỆN $00read03 = GUICtrlSetData(($get_edit0[3])[7-1],$a1[$lp][3]) ; 0 lay address input GIÁ ĐIỆN If $lp > 0 and $a1[$lp][3] = 0 Then $00read04 = GUICtrlSetData(($get_edit0[4])[7-1], FormatCurrency($a1[$lp][4]) ) ; 0 lay address input TIỀN ĐIỆN If $lp > 0 and $a1[$lp][3] > 0 Then $00read04 = GUICtrlSetData(($get_edit0[4])[7-1], FormatCurrency( ($a1[$lp][2]-$a0[$lp][2])*$a1[$lp][3] ) ) ; 0 lay address input TIỀN ĐIỆN $00read05 = GUICtrlSetData(($get_edit0[5])[7-1],$a1[$lp][5]) ; 0 lay address input ĐIỆN If $lp > 0 and StringInStr($a1[$lp][6], '&') < 0+1 Then $00read06 = GUICtrlSetData(($get_edit0[6])[7-1],$a1[$lp][6]-$a0[$lp][6]) ; 0 lay address input SỐ NƯỚC $00read07 = GUICtrlSetData(($get_edit0[7])[7-1],$a1[$lp][7]) ; 0 lay address input GIÁ NƯỚC If $a1[$lp][7] = 0 Then $00read08 = GUICtrlSetData(($get_edit0[8])[7-1], FormatCurrency($a1[$lp][8]) ) ; 0 lay address input TIỀN NƯỚC If $a1[$lp][7] > 0 Then $00read08 = GUICtrlSetData(($get_edit0[8])[7-1], FormatCurrency(($a1[$lp][6]-$a0[$lp][6])*$a1[$lp][7]) ) ; 0 lay address input TIỀN NƯỚC ElseIf $lp > 0 and StringInStr($a1[$lp][6], '&') > 0 Then $a1split = StringSplit($a1[$lp][6],"&",2) ;set Tint to 100 $a0split = StringSplit($a0[$lp][6],"&",2) ;set Tint to 100 $00read06 = GUICtrlSetData(($get_edit0[6])[7-1], ($a1split[0]-$a0split[0])+($a1split[1]-$a0split[1]) ) ; 0 lay address input SỐ NƯỚC If $a1[$lp][7] = 0 Then $00read08 = GUICtrlSetData(($get_edit0[8])[7-1], FormatCurrency($a1[$lp][8]) ) ; 0 lay address input TIỀN NƯỚC If $a1[$lp][7] > 0 Then $00read08 = GUICtrlSetData(($get_edit0[8])[7-1], FormatCurrency( (($a1split[0]-$a0split[0])+($a1split[1]-$a0split[1]))*$a1[$lp][7] ) ) ; 0 lay address input TIỀN NƯỚC EndIf $00read09 = GUICtrlSetData(($get_edit0[9])[7-1],$a1[$lp][9]) ; 0 lay address input NƯỚC $00read10 = GUICtrlSetData(($get_edit0[10])[7-1],FormatCurrency($a1[$lp][10]) ) ; 0 lay address input INTERNET $00read11 = GUICtrlSetData(($get_edit0[11])[7-1],FormatCurrency($a1[$lp][11]) ) ; 0 lay address input XE MÁY $00read12 = GUICtrlSetData(($get_edit0[12])[7-1],FormatCurrency($a1[$lp][12]) ) ; 0 lay address input VSMT Next EndFunc Func FormatCurrency($sText) Local $sResult = "" Local $aParts = StringRegExp($sText, "(\d+)", 3) If Not IsArray($aParts) Then Return $sText For $i = 0 To UBound($aParts) - 1 Local $sOriginal = $aParts[$i] Local $sFormatted = "" While StringLen($sOriginal) > 3 $sFormatted = "." & StringRight($sOriginal, 3) & $sFormatted $sOriginal = StringLeft($sOriginal, StringLen($sOriginal) - 3) WEnd $sFormatted = $sOriginal & $sFormatted $sText = StringReplace($sText, $aParts[$i], $sFormatted, 1) Next Return $sText EndFunc ; Ví dụ sử dụng: ;Local $iSoTien = 375000 ;Local $sTien = FormatCurrency($iSoTien) ;MsgBox(0, "Số tiền", $sTien) ; Hiển thị: 375.000 GUICtrlSetState( ($button_auto02[3])[7-1], $GUI_UNCHECKED) GUICtrlSetData_down01($idCheckbox35_tiled02_02,$time_stop01&" "&($button_auto02[3])[0]&" DONE " ) ; $button_auto02 ElseIf $xx > ($button_auto02[5])[1] And $yy > ($button_auto02[5])[2] And $xx < ($button_auto02[5])[1]+($button_auto02[5])[3] And $yy < ($button_auto02[5])[2]+($button_auto02[5])[4] Then ; click button "Select" ; Hộp thoại chọn tệp Local $selectedFile = FileOpenDialog("Chọn tệp 01", @WindowsDir, "Tất cả các tệp (*.*)", 1) ; Kiểm tra xem người dùng có chọn tệp hay không If @error Then ;MsgBox(16, "Lỗi", "Bạn chưa chọn tệp nào!") Else ;MsgBox(64, "Tệp được chọn", "Đường dẫn tệp: " & $selectedFile) Local $aRetArray01 ; Re-read it - without count _FileReadToArray($selectedFile, $aRetArray01, $FRTA_NOCOUNT, "|") ;_ArrayDisplay($aRetArray01, "2D array - no count", Default, 8) EndIf GUICtrlSetData($idCheckbox35_tiled01_01, _ArrayToString($aRetArray01)) _write_edit01($aRetArray01) GUICtrlSetState( ($button_auto02[5])[7-1], $GUI_UNCHECKED) ;GUICtrlSetData_down01($idCheckbox35_tiled02_02,$time_stop01&" "&($button_auto02[5])[0]&" DONE " ) ; $button_auto02 ElseIf $xx > ($button_auto02[6])[1] And $yy > ($button_auto02[6])[2] And $xx < ($button_auto02[6])[1]+($button_auto02[6])[3] And $yy < ($button_auto02[6])[2]+($button_auto02[6])[4] Then ; click button "Select" ; Hộp thoại chọn tệp Local $selectedFile = FileOpenDialog("Chọn tệp 02", @WindowsDir, "Tất cả các tệp (*.*)", 1) ; Kiểm tra xem người dùng có chọn tệp hay không If @error Then ;MsgBox(16, "Lỗi", "Bạn chưa chọn tệp nào!") Else ;MsgBox(64, "Tệp được chọn", "Đường dẫn tệp: " & $selectedFile) Local $aRetArray02 ; Re-read it - without count _FileReadToArray($selectedFile, $aRetArray02, $FRTA_NOCOUNT, "|") ;_ArrayDisplay($aRetArray02, "2D array - no count", Default, 8) EndIf GUICtrlSetData($idCheckbox35_tiled02_02, _ArrayToString($aRetArray02)) _write_edit01($aRetArray02) Func _write_edit01($a0) $get_edit0 = $button_edit00 GUICtrlSetData(($get_edit0[0])[7-1], "Dữ liệu mới đã được cập nhật!") For $lp = 0 to 25 If $lp = 0 Then $get_edit0 = $button_edit00 If $lp = 1 Then $get_edit0 = $button_edit01 If $lp = 2 Then $get_edit0 = $button_edit02 If $lp = 3 Then $get_edit0 = $button_edit03 If $lp = 4 Then $get_edit0 = $button_edit04 If $lp = 5 Then $get_edit0 = $button_edit05 If $lp = 6 Then $get_edit0 = $button_edit06 If $lp = 7 Then $get_edit0 = $button_edit07 If $lp = 8 Then $get_edit0 = $button_edit08 If $lp = 9 Then $get_edit0 = $button_edit09 If $lp = 10 Then $get_edit0 = $button_edit10 If $lp = 11 Then $get_edit0 = $button_edit11 If $lp = 12 Then $get_edit0 = $button_edit12 If $lp = 13 Then $get_edit0 = $button_edit13 If $lp = 14 Then $get_edit0 = $button_edit14 If $lp = 15 Then $get_edit0 = $button_edit15 If $lp = 16 Then $get_edit0 = $button_edit16 If $lp = 17 Then $get_edit0 = $button_edit17 If $lp = 18 Then $get_edit0 = $button_edit18 If $lp = 19 Then $get_edit0 = $button_edit19 If $lp = 20 Then $get_edit0 = $button_edit20 If $lp = 21 Then $get_edit0 = $button_edit21 If $lp = 22 Then $get_edit0 = $button_edit22 If $lp = 23 Then $get_edit0 = $button_edit23 If $lp = 24 Then $get_edit0 = $button_edit24 If $lp = 25 Then $get_edit0 = $button_edit25 $00read00 = GUICtrlSetData(($get_edit0[0])[7-1],$a0[$lp][0]) ; 0 lay address input $00read01 = GUICtrlSetData(($get_edit0[1])[7-1],$a0[$lp][1]) ; 0 lay address input $00read02 = GUICtrlSetData(($get_edit0[2])[7-1],$a0[$lp][2]) ; 0 lay address input $00read03 = GUICtrlSetData(($get_edit0[3])[7-1],$a0[$lp][3]) ; 0 lay address input $00read04 = GUICtrlSetData(($get_edit0[4])[7-1],$a0[$lp][4]) ; 0 lay address input $00read05 = GUICtrlSetData(($get_edit0[5])[7-1],$a0[$lp][5]) ; 0 lay address input $00read06 = GUICtrlSetData(($get_edit0[6])[7-1],$a0[$lp][6]) ; 0 lay address input $00read07 = GUICtrlSetData(($get_edit0[7])[7-1],$a0[$lp][7]) ; 0 lay address input $00read08 = GUICtrlSetData(($get_edit0[8])[7-1],$a0[$lp][8]) ; 0 lay address input $00read09 = GUICtrlSetData(($get_edit0[9])[7-1],$a0[$lp][9]) ; 0 lay address input $00read10 = GUICtrlSetData(($get_edit0[10])[7-1],$a0[$lp][10]) ; 0 lay address input $00read11 = GUICtrlSetData(($get_edit0[11])[7-1],$a0[$lp][11]) ; 0 lay address input $00read12 = GUICtrlSetData(($get_edit0[12])[7-1],$a0[$lp][12]) ; 0 lay address input Next EndFunc GUICtrlSetState( ($button_auto02[6])[7-1], $GUI_UNCHECKED) ;GUICtrlSetData_down01($idCheckbox35_tiled02_02,$time_stop01&" "&($button_auto02[6])[0]&" DONE " ) ; end $button_auto02 ; $button_update01 ElseIf $xx > ($button_update01[0])[1] And $yy > ($button_update01[0])[2] And $xx < ($button_update01[0])[1]+($button_update01[0])[3] And $yy < ($button_update01[0])[2]+($button_update01[0])[4] Then ; click button "Select" GUICtrlSetData($idCheckbox35_tiled01_01, "") GUICtrlSetData_down01($idCheckbox35_tiled01_01,$time_stop01&" "&$button_update01[0]) MsgBox($MB_SYSTEMMODAL, "UPDATE NEW", $path_file01&" = "&InetGet($http_23_239_25_77_acc_&$path_file01, $c_acc_&$path_file01, $INET_FORCERELOAD)&@CRLF& _ "update = "&"Done",0) Exit GUICtrlSetData_down01($idCheckbox35_tiled01_01,$time_stop01&" "&($button_update01[0])[0]&" DONE " ) ; $button_update01 ElseIf $xx > ($button_update01[1])[1] And $yy > ($button_update01[1])[2] And $xx < ($button_update01[1])[1]+($button_update01[1])[3] And $yy < ($button_update01[1])[2]+($button_update01[1])[4] Then ; click button "Select" GUICtrlSetData($idCheckbox35_tiled01_01, "") GUICtrlSetData_down01($idCheckbox35_tiled01_01,$time_stop01&" "&$button_update01[0]) ; -------------------------------------- $up_file01 = InputBox("Testing", "file name to download", $default_download01, " M50") If $up_file01 <> "" Then Local $sFilePath01 = 'c:\acc\'&$up_file01 MsgBox($MB_SYSTEMMODAL, "UPDATE NEW", $sFilePath01&" = "&InetGet("http://23.239.25.77/acc/"&$up_file01, $sFilePath01, $INET_FORCERELOAD)&@CRLF& _ "update = "&"Done",0) ; end -------------------------------------- EndIf Exit GUICtrlSetData_down01($idCheckbox35_tiled01_01,$time_stop01&" "&($button_update01[1])[0]&" DONE " ) ; end $button_update01 Func binance_all_data01($Symbol00="BTCUSDT", $button_submit00num=1) $Symbol01 = StringReplace($Symbol00, "-", "") GUICtrlSetData($idCheckbox35_tiled01_01, "") $edit_view01 = "" ; 1 time $b_api_v3_01 = _BINANCE_API_Call_api_all01("api.binance.com","api/v3/time") ; ; v5 = api-testnet.bybit.com v3 = "api.binance.com" v1 = "fapi.binance.com" time ok 1 ;ClipPut($b_api_v3_01[2]) $g_api_v3_time01 = $b_api_v3_01[2] $g_api_v3_time01 = StringReplace($g_api_v3_time01, '{"serverTime":', "") ; fix dau cach $g_api_v3_time01 = StringReplace($g_api_v3_time01, '}', "") ; fix dau cach $convertedTime = ConvertServerTimeToVietnamTime($g_api_v3_time01) $edit_view01 &= $Symbol01&@CRLF $edit_view01 &= $convertedTime&@CRLF ;GUICtrlSetData($button_submit06, $edit_view01) ; end 1 time ; 2 Open Interest lấy USDT Col2 $b_api_v1_01 =_BINANCE_API_Call_api_all01("fapi.binance.com","futures/data/openInterestHist",'symbol='&$Symbol01&'&period=5m&limit=5') ; v5 = api-testnet.bybit.com v3 = "api.binance.com" v1 = "fapi.binance.com" ; openInterest ok 2 ; period="5m","15m","30m","1h","2h","4h","6h","12h","1d" limit=30 max 500 $b_api_v1_01_data2 = BinaryToString($b_api_v1_01[2]) $open_insert01 = _b_openInterestHist02($b_api_v1_01_data2,$Symbol01) ;GUICtrlSetData($button_submit02, StringReplace(_ArrayToString($open_insert01), "|", " | ")) ; end 2 Open Interest lấy USDT Col2 ; 3 long shot lấy col1 col3 $b_api_v1_01 = _BINANCE_API_Call_api_all01("fapi.binance.com","futures/data/globalLongShortAccountRatio",'symbol='&$Symbol01&'&period=5m&limit=5') ; v5 = api-testnet.bybit.com v3 = "api.binance.com" v1 = "fapi.binance.com" ; Tỉ lệ Long/Short ok 3 ; period="5m","15m","30m","1h","2h","4h","6h","12h","1d" limit=30 max 500 $b_api_v1_01_data2 = BinaryToString($b_api_v1_01[2]) $long_shot01 =_b_globalLongShortAccountRatio02($b_api_v1_01_data2,$Symbol01) ;GUICtrlSetData($button_submit03, StringReplace(_ArrayToString($long_shot01), "|", " | ")) ; end 3 long shot lấy col1 col3 ; 4 taker buy sell lấy col2 col3 $b_api_v1_01 = _BINANCE_API_Call_api_all01("fapi.binance.com","futures/data/takerlongshortRatio",'symbol='&$Symbol01&'&period=5m&limit=5') ; v5 = api-testnet.bybit.com v3 = "api.binance.com" v1 = "fapi.binance.com" ; Tỉ lệ Long/Short ok 3 ; period="5m","15m","30m","1h","2h","4h","6h","12h","1d" limit=30 max 500 $b_api_v1_01_data2 = BinaryToString($b_api_v1_01[2]) $taker_buy_sell01 = _b_takerlongshortRatio02($b_api_v1_01_data2,$Symbol01) ;GUICtrlSetData($button_submit04, StringReplace(_ArrayToString($taker_buy_sell01), "|", " | ")) ; 5 basic lấy col1 $b_api_v1_01 = _BINANCE_API_Call_api_all01("fapi.binance.com","fapi/v1/klines",'symbol='&$Symbol01&'&interval=5m&limit=5') ; v5 = api-testnet.bybit.com v3 = "api.binance.com" v1 = "fapi.binance.com" ; basic futures price ok 5 ; period="5m","15m","30m","1h","2h","4h","6h","12h","1d" limit=30 max 500 $b_api_v1_01_data2 = BinaryToString($b_api_v1_01[2]) $basics_futures_price01 = _b_klines02($b_api_v1_01_data2,$Symbol01) ;GUICtrlSetData($button_submit05, StringReplace(_ArrayToString($basics_futures_price01), "|", " | ")) If $button_submit00num = 1 Then _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($button_submit01)) If $button_submit00num = 2 Then _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($button_submit02)) If $button_submit00num = 3 Then _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($button_submit03)) If $button_submit00num = 4 Then _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($button_submit04)) If $button_submit00num = 5 Then _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($button_submit05)) If $button_submit00num = 6 Then _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($button_submit06)) ; Thêm dữ liệu vào ListView ;For $i = 0+1 To UBound($long_shot01) - 1 ; GUICtrlCreateListViewItem($long_shot01[$i][0] & "|" & $long_shot01[$i][1] & "|" & $long_shot01[$i][2] & "|" & $long_shot01[$i][3] & "|" & $long_shot01[$i][4], $button_submit01) ;Next $limi0 = 5 For $i = 0+1 To $limi0 $Sym01 = $Symbol01 $usd0 = "" $long0 = "" $shot0 = "" $sell0 = "" $buy0 = "" $basics0 = "" $time0 = "" $usd0 = $open_insert01[$i][2] $time0 = StringReplace($open_insert01[$i][3], "2025-", "") $time0 = StringReplace($open_insert01[$i][3], "2026-", "") $time0 = StringReplace($open_insert01[$i][3], "2027-", "") $time0 = StringReplace($open_insert01[$i][3], "2028-", "") For $lp_1 = 1 To $limi0 If $open_insert01[$i][3] = $long_shot01[$lp_1][4] Then $long0 = $long_shot01[$lp_1][1] $shot0 = $long_shot01[$lp_1][3] ExitLoop EndIf Next For $lp_2 = 1 To $limi0 If $open_insert01[$i][3] = $taker_buy_sell01[$lp_2][4] Then $sell0 = $taker_buy_sell01[$lp_2][2] $buy0 = $taker_buy_sell01[$lp_2][3] ExitLoop EndIf Next For $lp_3 = 1 To $limi0 If $open_insert01[$i][3] = $basics_futures_price01[$lp_3][6] Then $basics0 = $basics_futures_price01[$lp_3][1] ExitLoop EndIf Next If $button_submit00num = 1 Then GUICtrlCreateListViewItem($Symbol01 & "|" & $usd0& "|" & $long0& "|" & $shot0& "|" & $sell0& "|" & $buy0& "|" & $basics0& "|" & $time0, $button_submit01) If $button_submit00num = 2 Then GUICtrlCreateListViewItem($Symbol01 & "|" & $usd0& "|" & $long0& "|" & $shot0& "|" & $sell0& "|" & $buy0& "|" & $basics0& "|" & $time0, $button_submit02) If $button_submit00num = 3 Then GUICtrlCreateListViewItem($Symbol01 & "|" & $usd0& "|" & $long0& "|" & $shot0& "|" & $sell0& "|" & $buy0& "|" & $basics0& "|" & $time0, $button_submit03) If $button_submit00num = 4 Then GUICtrlCreateListViewItem($Symbol01 & "|" & $usd0& "|" & $long0& "|" & $shot0& "|" & $sell0& "|" & $buy0& "|" & $basics0& "|" & $time0, $button_submit04) If $button_submit00num = 5 Then GUICtrlCreateListViewItem($Symbol01 & "|" & $usd0& "|" & $long0& "|" & $shot0& "|" & $sell0& "|" & $buy0& "|" & $basics0& "|" & $time0, $button_submit05) If $button_submit00num = 6 Then GUICtrlCreateListViewItem($Symbol01 & "|" & $usd0& "|" & $long0& "|" & $shot0& "|" & $sell0& "|" & $buy0& "|" & $basics0& "|" & $time0, $button_submit06) Next If $button_submit00num = 1 Then _ListView_column_w01($button_submit01) If $button_submit00num = 2 Then _ListView_column_w01($button_submit02) If $button_submit00num = 3 Then _ListView_column_w01($button_submit03) If $button_submit00num = 4 Then _ListView_column_w01($button_submit04) If $button_submit00num = 5 Then _ListView_column_w01($button_submit05) If $button_submit00num = 6 Then _ListView_column_w01($button_submit06) GUICtrlSetData_down01($idCheckbox35_tiled01_01,$time_stop01&" "&($button_auto03[5])[0]&" GET[0] "&$b_api_v1_01[0] ) GUICtrlSetData_down01($idCheckbox35_tiled01_01,$time_stop01&" "&($button_auto03[5])[0]&" GET[1] "&$b_api_v1_01[1] ) EndFunc GUICtrlSetState( ($button_auto04[1])[7-1], $GUI_UNCHECKED) ;GUICtrlSetData_down01($idCheckbox35_tiled01_01,$time_stop01&" "&($button_auto04[1])[0]&" DONE " ) ; end $button_auto04 ; $usd0 = $open_insert01[$i][2] ; $long0 = $long_shot01[$i][1] ; $shot0 = $long_shot01[$i][3] ; $sell0 = $taker_buy_sell01[$i][2] ; $buy0 = $taker_buy_sell01[$i][3] ; $basics0 = $basics_futures_price01[$i][1] ; $time0 = $open_insert01[$i][3] EndIf ; end click button "X EXIT" > button gui x y width height ------------------------------------------------------------------ EndIf ; end _IsPressed('01') EndSwitch WEnd Func _ListView_column_w01($button_submit00) ; Điều chỉnh độ rộng cột _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($button_submit00), 0, 0) ; SYM _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($button_submit00), 1, 80) ; USD _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($button_submit00), 2, 50) ; LONG _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($button_submit00), 3, 50) ; SHOT _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($button_submit00), 4, 65) ; SELL _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($button_submit00), 5, 65) ; BUY _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($button_submit00), 6, 70) ; BASIC _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($button_submit00), 7, 110) ; TIME EndFunc Func _b_klines02($b_api_v1_01_data00,$Symbol00="BTCUSDT",$view01on=0) $b_api_v1_01_data00 = BinaryToString($b_api_v1_01_data00) ; Phân tích JSON thành mảng AutoIt Local $aCryptos = _JSON_Parse($b_api_v1_01_data00) ; Khởi tạo mảng để hiển thị kết quả Local $aResults[1][7] = [[ 'Symbol','Giá mở cửa', 'Giá cao nhất', 'Giá thấp nhất', 'Giá đóng cửa', 'Khối lượng giao dịch','Timestamp']] ; Duyệt qua dữ liệu JSON và thêm vào mảng kết quả Local $mCurrency, $convertedTime For $i = 0 To UBound($aCryptos) - 1 $mCurrency = $aCryptos[$i] $convertedTime = ConvertServerTimeToVietnamTime($mCurrency[0]) ;$price_open01 = AddCommasInteger($mCurrency[1]) ;$price_high02 = AddCommasInteger($mCurrency[2]) ;$price_low03 = AddCommasInteger($mCurrency[3]) ;$price_close04 = AddCommasInteger($mCurrency[4]) ;$price_ignore05 = AddCommasInteger($mCurrency[5]) $price_open01 = $mCurrency[1] $price_high02 = $mCurrency[2] $price_low03 = $mCurrency[3] $price_close04 = $mCurrency[4] $price_ignore05 = $mCurrency[5] ; Thêm dữ liệu từng phần tử vào mảng kết quả _ArrayAdd($aResults, $Symbol00 & '|' & $price_open01 & '|' & $price_high02 & '|' & $price_low03 & '|' & $price_close04 & '|' & $price_ignore05 & '|' & $convertedTime ) Next ; Hiển thị mảng bằng _ArrayDisplay If $view01on = 1 Then _ArrayDisplay($aResults, "Hiển thị JSON dưới dạng bảng") Return $aResults EndFunc Func _b_takerlongshortRatio02($b_api_v1_01_data00,$Symbol00="BTCUSDT",$view01on=0) $b_api_v1_01_data00 = BinaryToString($b_api_v1_01_data00) ; Phân tích JSON thành mảng AutoIt Local $aCryptos = _JSON_Parse($b_api_v1_01_data00) ; Khởi tạo mảng để hiển thị kết quả Local $aResults[1][5] = [['Symbol', 'buySellRatio', 'sellVol', 'buyVol', 'Timestamp']] ; Duyệt qua dữ liệu JSON và thêm vào mảng kết quả Local $mCurrency For $i = 0 To UBound($aCryptos) - 1 $mCurrency = $aCryptos[$i] ; Thêm dữ liệu từng phần tử vào mảng kết quả $buyVol = StringTrimRight($mCurrency['buyVol'], 1) ; Loại bỏ chữ số 0 cuối $sellVol = StringTrimRight($mCurrency['sellVol'], 1) ; Loại bỏ chữ số 0 cuối $convertedTime = ConvertServerTimeToVietnamTime($mCurrency['timestamp']) ;_ArrayAdd($aResults, $mCurrency['symbol'] & '|' & $mCurrency['longAccount'] & '|' & $mCurrency['longShortRatio'] & '|' & $mCurrency['shortAccount'] & '|' & $convertedTime ) ;_ArrayAdd($aResults, $Symbol00 & '|' & $mCurrency['buySellRatio'] & '|' & $mCurrency['sellVol'] & '|' & $mCurrency['buyVol'] & '|' & $convertedTime ) _ArrayAdd($aResults, $Symbol00 & '|' & $mCurrency['buySellRatio'] & '|' & $sellVol & '|' & $buyVol & '|' & $convertedTime ) Next ; Hiển thị mảng bằng _ArrayDisplay If $view01on = 1 Then _ArrayDisplay($aResults, "Hiển thị JSON dưới dạng bảng") Return $aResults EndFunc Func _b_openInterestHist02($b_api_v1_01_data00,$Symbol00="BTCUSDT",$view01on=0) $b_api_v1_01_data00 = BinaryToString($b_api_v1_01_data00) ; Phân tích JSON thành mảng AutoIt Local $aCryptos = _JSON_Parse($b_api_v1_01_data00) ; Khởi tạo mảng để hiển thị kết quả Local $aResults[1][4] = [['Symbol', 'Sum Open Interest', 'Sum Open Interest Value', 'Timestamp']] ; Duyệt qua dữ liệu JSON và thêm vào mảng kết quả Local $mCurrency, $convertedTime For $i = 0 To UBound($aCryptos) - 1 $mCurrency = $aCryptos[$i] ; Chuyển đổi thời gian từ timestamp sang định dạng dễ đọc $convertedTime = ConvertServerTimeToVietnamTime($mCurrency['timestamp']) ; Định dạng giá trị `sumOpenInterest` với 3 chữ số thập phân và `sumOpenInterestValue` với 2 chữ số thập phân $formattedSumOpenInterest = FormatNumberWithCommas01($mCurrency['sumOpenInterest'], False) $formattedSumOpenInterestValue = FormatNumberWithCommas02(TruncateDecimal($mCurrency['sumOpenInterestValue']), True) ; Thêm dữ liệu từng phần tử vào mảng kết quả _ArrayAdd($aResults, $Symbol00 & '|' & $formattedSumOpenInterest & '|' & $formattedSumOpenInterestValue & '|' & $convertedTime) Next ; Hiển thị mảng bằng _ArrayDisplay If $view01on = 1 Then _ArrayDisplay($aResults, "Hiển thị JSON dưới dạng bảng") Return $aResults EndFunc Func _b_globalLongShortAccountRatio02($b_api_v1_01_data00,$Symbol00="BTCUSDT",$view01on=0) $b_api_v1_01_data00 = BinaryToString($b_api_v1_01_data00) ; Phân tích JSON thành mảng AutoIt Local $aCryptos = _JSON_Parse($b_api_v1_01_data00) ; Khởi tạo mảng để hiển thị kết quả Local $aResults[1][5] = [['Symbol', 'Long Account', 'Long-Short Ratio', 'Short Account', 'Timestamp']] ; Duyệt qua dữ liệu JSON và thêm vào mảng kết quả Local $mCurrency For $i = 0 To UBound($aCryptos) - 1 $mCurrency = $aCryptos[$i] ; Thêm dữ liệu từng phần tử vào mảng kết quả Local $longAccount = Number($mCurrency["longAccount"]) * 100 & "%" Local $longShortRatio = Round(Number($mCurrency["longShortRatio"]),2) Local $shortAccount = Number($mCurrency["shortAccount"]) * 100 & "%" $convertedTime = ConvertServerTimeToVietnamTime($mCurrency['timestamp']) ;_ArrayAdd($aResults, $mCurrency['symbol'] & '|' & $mCurrency['longAccount'] & '|' & $mCurrency['longShortRatio'] & '|' & $mCurrency['shortAccount'] & '|' & $convertedTime ) ;_ArrayAdd($aResults, $Symbol00 & '|' & $mCurrency['longAccount'] & '|' & $mCurrency['longShortRatio'] & '|' & $mCurrency['shortAccount'] & '|' & $convertedTime ) _ArrayAdd($aResults, $Symbol00 & '|' & $longAccount & '|' & $longShortRatio & '|' & $shortAccount & '|' & $convertedTime ) Next ; Hiển thị mảng bằng _ArrayDisplay If $view01on = 1 Then _ArrayDisplay($aResults, "Hiển thị JSON dưới dạng bảng") Return $aResults EndFunc Func HexStringReverse($HexString, $delim= " ",$type0="string") ;coded by UEZ 2011 > string hex color "f44336" > Dec("3643f4") $return0 = "" If Not IsString($HexString) Then Return SetError(1, 0, 0) ;not a string If StringRegExpReplace($HexString, "(?i)[0-9a-fs]", "") Then Return SetError(2, 0, 0) ;not a hex string Local $aResult = StringSplit($HexString, " ") If Not @error Then $aResult = StringSplit(StringRegExpReplace($HexString, "b([w])b", "0$1"), " ", 2) Else If Mod(StringLen($HexString), 2) Then $HexString = "0" & $HexString $aResult = StringRegExp($HexString, ".{2}", 3) EndIf _ArrayReverse($aResult) $return0 = _ArrayToString($aResult, $delim) If $type0="dec" Then $return0 = Dec($return0) Return $return0 EndFunc Func STUN_GetMyIP() ; Some STUN servers and their ports Local $aServers[14][2] = [["stun.l.google.com", 19302], _ ["stun.ekiga.net", 3478], _ ["stun.sipgate.net", 10000], _ ["stun1.l.google.com", 19302], _ ["stun.ideasip.com", 3478], _ ["stun2.l.google.com", 19302], _ ["stunserver.org", 3478], _ ["stun3.l.google.com", 19302], _ ["stun.rixtelecom.se", 3478], _ ["stun4.l.google.com", 19302], _ ["stun.schlund.de", 3478], _ ["stun.voiparound.com", 3478], _ ["stun.voipbuster.com", 3478], _ ["stun.voipstunt.com", 3478]] Local Const $MAPPED_ADDRESS = 0x0001 ; interested in this info Local Const $IPv4 = 0x01 ; IPv4 format Local Const $IPv6 = 0x02 ; IPv6 format ; Generate request Local $bRandom12 = STUN_GenerateRandom12() ; some random unique ID in size of 12 bytes ; Binding request has class=0x00 and method=0x000000000001 (Binding) and is encoded into the first two bytes as 0x0001. Check http://tools.ietf.org/html/rfc5389#section-15 Local $bBinary = Binary("0x0001000000000000") & $bRandom12 Local $sIpServ, $aSocket, $bRcvData UDPStartup() For $i = 0 To UBound($aServers) - 1 $sIpServ = TCPNameToIP($aServers[$i][0]) If @error Then ContinueLoop ; couldn't resolve server's IP $aSocket = UDPOpen($sIpServ, $aServers[$i][1]) UDPSend($aSocket, $bBinary) For $j = 1 To 3 ; read few (e.g. three) times if necessary $bRcvData = UDPRecv($aSocket, 1280) ; never more than 1280 bytes can be returned by the server. Usually it's 50-something bytes. If @error Then ExitLoop ; e.g. firewall rule blocks If $bRcvData Then ExitLoop 2 ; successfully read, get out of the loops Sleep(0) ; give it time to process Next UDPCloseSocket($aSocket) Next UDPCloseSocket($aSocket) UDPShutdown() #cs ; Struct can be written now in place of binary data, but it's all big-endian (weird for reading in AutoIt): Local $tSTUN = DllStructCreate("byte Header_[8]; byte Header_ID[12];" & _ "byte Type[2];" & _ "byte Length[2];" & _ "byte Attrib;" & _ "byte Family;" & _ "byte Port[2];" & _ "byte IP[4];") #ce ; ...so I will just parse binary directly instead. Local $iSizeData = BinaryLen($bRcvData) If $iSizeData Then ; sanity check Local $bReadID = BinaryMid($bRcvData, 9, 12) ; server returns my unique "ID" Local $iType, $iLength = 0 Local $iPos = 21 ; further parsing starts after the header, see the struct and STUN doc If $bReadID = $bRandom12 Then ; check validity of the response by checking returned ID (handle) While $iPos < $iSizeData $iType = STUN_Read_BE_Bin(BinaryMid($bRcvData, $iPos, 2)) $iPos += 2 ; skip the size of "Type" field $iLength = STUN_Read_BE_Bin(BinaryMid($bRcvData, $iPos, 2)) $iPos += 2 ; skip the size of "Length" field If $iType = $MAPPED_ADDRESS Then ExitLoop $iPos += $iLength ; skip the size of all of the data in this chunk WEnd EndIf $iPos += 1 ; skip the size of "Attrib" field Local $iFamily = STUN_Read_BE_Bin(BinaryMid($bRcvData, $iPos, 1)) ; read "Family" info. $iPos += 1 ; skip the size of "Family" field $iPos += 2 ; skip the size of "Port" field If $iFamily = $IPv4 Then ; Read IP info. Four bytes are IP in network byte order (big endian) Return Int(BinaryMid($bRcvData, $iPos, 1)) & "." & Int(BinaryMid($bRcvData, $iPos + 1, 1)) & "." & Int(BinaryMid($bRcvData, $iPos + 2, 1)) & "." & Int(BinaryMid($bRcvData, $iPos + 3, 1)) ElseIf $iFamily = $IPv6 Then ; IPv6 - you do it, I'll just return error: Return SetError(1, 0, ":::::::") EndIf ; No such data available Return SetError(2, 0, "") EndIf ; You are blocked or something Return SetError(3, 0, "") EndFunc Func STUN_Read_BE_Bin($bBinary) ; Big endian to number Return Dec(Hex($bBinary)) EndFunc Func STUN_GenerateRandom12() ; Whatever Return BinaryMid(BinaryMid(Binary(Random(1.1, 2 ^ 31 - 1)), 1, 6) & Binary(Random(1.1, 2 ^ 31 - 1)), 1, 12) EndFunc Func GUICtrlSetData_down01($gui_edit00,$text,$scroll="down") If $scroll="down" Then $scroll=-1 If $scroll="up" Then $scroll=0 $index = _GUICtrlListBox_InsertString($gui_edit00, $text, $scroll) ; <<<<<<<<<<<<<<<<<<<<< _GUICtrlListBox_SetTopIndex($gui_edit00, $index) EndFunc Func GUICtrlSetData_down02($gui_edit00,$text) _GUICtrlListBox_BeginUpdate($gui_edit00) $index = _GUICtrlListBox_AddString($gui_edit00, $text) _GUICtrlListBox_SetTopIndex($gui_edit00, $index) _GUICtrlListBox_UpdateHScroll($gui_edit00) ; to correct size of horiz scrollbar for texts with big width _GUICtrlListBox_EndUpdate($gui_edit00) EndFunc Func _BINANCE_API_Call_fapi_v1($sEndPoint, $sParameters = "") ;************************************************** ; Performs Binance API Call Via Native WinHTTP dll ;************************************************** ;----- Vars ----- ; Presume GET, assign POST if needed in switch Local $sGETorPOST = "GET" ;----- Check Endpoint Required ----- ; Some endpoints require signing, other endpoints can be ; added as new cases. Switch $sEndPoint Case "api/v3/account" $sParameters &= "×tamp=" & _TimeStamp() $sParameters &= "&signature=" & _HMAC($sParameters, $sAPI_Key_Secret) Case "api/v3/order" $sGETorPOST = "POST" $sParameters &= "×tamp=" & _TimeStamp() $sParameters &= "&signature=" & _HMAC($sParameters, $sAPI_Key_Secret) Case "api/v3/myTrades" $sParameters &= "×tamp=" & _TimeStamp() $sParameters &= "&signature=" & _HMAC($sParameters, $sAPI_Key_Secret) EndSwitch ;----- Start Session ----- Local $hHTTP_Session = DllCall($hDll_WinHTTP, "handle", "WinHttpOpen", "wstr", "Mozilla/4.0", "dword", 0, "wstr", "", "wstr", "", "dword", 0)[0] ;----- Connect To Binance Server ----- Local $hHTTP_Connection = DllCall($hDll_WinHTTP, "handle", "WinHttpConnect", "handle", $hHTTP_Session, "wstr", "fapi.binance.com", "dword", 443, "dword", 0)[0] ;----- Prepare Request Data ----- If $sParameters <> "" Then $sParameters = "?" & $sParameters Local $hHTTP_Request = DllCall($hDll_WinHTTP, "handle", "WinHttpOpenRequest", "handle", $hHTTP_Connection, "wstr", $sGETorPOST, "wstr", $sEndPoint & $sParameters, "wstr", "HTTP/1.1", "wstr", "", "ptr", 0, "dword", 0x00800000)[0] ;----- Add Request Header ----- ; Adds API key to header even if not specifically needed, inconsequential DllCall($hDll_WinHTTP, "bool", "WinHttpAddRequestHeaders", "handle", $hHTTP_Request, "wstr", "X-MBX-APIKEY: " & $sAPI_Key_Access, "dword", -1, "dword", 0x10000000) ;----- Send Request To Server ----- DllCall($hDll_WinHTTP, "bool", "WinHttpSendRequest", "handle", $hHTTP_Request, "wstr", "", "dword", 0, "ptr", 0, "dword", 0, "dword", 0, "dword_ptr", 0) ;----- Recieve Response ----- DllCall($hDll_WinHTTP, "bool", "WinHttpReceiveResponse", "handle", $hHTTP_Request, "ptr", 0) ;----- Recieve Headers ----- ; Extract HTTP return code and API weight Local $sHeaders = DllCall($hDll_WinHTTP, "bool", "WinHttpQueryHeaders", "handle", $hHTTP_Request, "dword", 22, "wstr", "", "wstr", "", "dword*", 65536, "dword*", 0)[4] Global $sHTTP_ReturnCode = StringMid($sHeaders, StringInStr($sHeaders, "HTTP/1.1 ") + 9, StringInStr($sHeaders, @CR, 0, 1, StringInStr($sHeaders, "HTTP/1.1 ") + 9) - (StringInStr($sHeaders, "HTTP/1.1 ") + 9)) Global $sAPI_Weight = StringMid($sHeaders, StringInStr($sHeaders, "x-mbx-used-weight: ") + 19, StringInStr($sHeaders, @CR, 0, 1, StringInStr($sHeaders, "x-mbx-used-weight: ") + 19) - (StringInStr($sHeaders, "x-mbx-used-weight: ") + 19)) Local $sAPI_IPBan_RetryAfter_Sec = StringInStr($sHeaders, "Retry-After: ") = 0 ? "" : StringMid($sHeaders, StringInStr($sHeaders, "Retry-After: ") + 13, StringInStr($sHeaders, @CR, 0, 1, StringInStr($sHeaders, "Retry-After: ") + 13) - (StringInStr($sHeaders, "Retry-After: ") + 13)) ;----- Get Data ----- Global $sData = "" Local $iBytesToRead, $hBuffer_Data While 1 ;- Get Bytes To Read In This Loop - $iBytesToRead = DllCall($hDll_WinHTTP, "bool", "WinHttpQueryDataAvailable", "handle", $hHTTP_Request, "dword*", 0)[2] ;- Check If No More Data To Read - If $iBytesToRead <= 0 Then ExitLoop ;- Prep Data Buffer - $hBuffer_Data = DllStructCreate("char[" & $iBytesToRead & "]") ;- Read Data To Buffer - DllCall($hDll_WinHTTP, "bool", "WinHttpReadData", "handle", $hHTTP_Request, "struct*", $hBuffer_Data, "dword", $iBytesToRead, "dword*", 0) ;- Get Data From Buffer - $sData &= DllStructGetData($hBuffer_Data, 1) ;- Release - $hBuffer_Data = "" WEnd ;----- Close Handles ----- DllCall($hDll_WinHTTP, "bool", "WinHttpCloseHandle", "handle", $hHTTP_Request) DllCall($hDll_WinHTTP, "bool", "WinHttpCloseHandle", "handle", $hHTTP_Connection) DllCall($hDll_WinHTTP, "bool", "WinHttpCloseHandle", "handle", $hHTTP_Session) ;----- Return Data ----- ; Include HTTP Code and API Weight to check for overuse, and retry period if banned ; HTTP CODES : 429=over request limit, 418=IP banned due to overuse ; API WEIGHT : over 1200 will lead to ban Return '{"HTTPCode":"' & $sHTTP_ReturnCode & '","APIWeight":"' & $sAPI_Weight & ($sAPI_IPBan_RetryAfter_Sec = "" ? "" : '","Retry-After":"' & $sAPI_IPBan_RetryAfter_Sec) & '"}' & $sData EndFunc ;==>_BINANCE_API_Call_api_v3 Func _BINANCE_API_Call_api_v3($sEndPoint, $sParameters = "") ;************************************************** ; Performs Binance API Call Via Native WinHTTP dll ;************************************************** ;----- Vars ----- ; Presume GET, assign POST if needed in switch Local $sGETorPOST = "GET" ;----- Check Endpoint Required ----- ; Some endpoints require signing, other endpoints can be ; added as new cases. Switch $sEndPoint Case "api/v3/account" $sParameters &= "×tamp=" & _TimeStamp() $sParameters &= "&signature=" & _HMAC($sParameters, $sAPI_Key_Secret) Case "api/v3/order" $sGETorPOST = "POST" $sParameters &= "×tamp=" & _TimeStamp() $sParameters &= "&signature=" & _HMAC($sParameters, $sAPI_Key_Secret) Case "api/v3/myTrades" $sParameters &= "×tamp=" & _TimeStamp() $sParameters &= "&signature=" & _HMAC($sParameters, $sAPI_Key_Secret) EndSwitch ;----- Start Session ----- Local $hHTTP_Session = DllCall($hDll_WinHTTP, "handle", "WinHttpOpen", "wstr", "Mozilla/4.0", "dword", 0, "wstr", "", "wstr", "", "dword", 0)[0] ;----- Connect To Binance Server ----- Local $hHTTP_Connection = DllCall($hDll_WinHTTP, "handle", "WinHttpConnect", "handle", $hHTTP_Session, "wstr", "api.binance.com", "dword", 443, "dword", 0)[0] ;----- Prepare Request Data ----- If $sParameters <> "" Then $sParameters = "?" & $sParameters Local $hHTTP_Request = DllCall($hDll_WinHTTP, "handle", "WinHttpOpenRequest", "handle", $hHTTP_Connection, "wstr", $sGETorPOST, "wstr", $sEndPoint & $sParameters, "wstr", "HTTP/1.1", "wstr", "", "ptr", 0, "dword", 0x00800000)[0] ;----- Add Request Header ----- ; Adds API key to header even if not specifically needed, inconsequential DllCall($hDll_WinHTTP, "bool", "WinHttpAddRequestHeaders", "handle", $hHTTP_Request, "wstr", "X-MBX-APIKEY: " & $sAPI_Key_Access, "dword", -1, "dword", 0x10000000) ;----- Send Request To Server ----- DllCall($hDll_WinHTTP, "bool", "WinHttpSendRequest", "handle", $hHTTP_Request, "wstr", "", "dword", 0, "ptr", 0, "dword", 0, "dword", 0, "dword_ptr", 0) ;----- Recieve Response ----- DllCall($hDll_WinHTTP, "bool", "WinHttpReceiveResponse", "handle", $hHTTP_Request, "ptr", 0) ;----- Recieve Headers ----- ; Extract HTTP return code and API weight Local $sHeaders = DllCall($hDll_WinHTTP, "bool", "WinHttpQueryHeaders", "handle", $hHTTP_Request, "dword", 22, "wstr", "", "wstr", "", "dword*", 65536, "dword*", 0)[4] Global $sHTTP_ReturnCode = StringMid($sHeaders, StringInStr($sHeaders, "HTTP/1.1 ") + 9, StringInStr($sHeaders, @CR, 0, 1, StringInStr($sHeaders, "HTTP/1.1 ") + 9) - (StringInStr($sHeaders, "HTTP/1.1 ") + 9)) Global $sAPI_Weight = StringMid($sHeaders, StringInStr($sHeaders, "x-mbx-used-weight: ") + 19, StringInStr($sHeaders, @CR, 0, 1, StringInStr($sHeaders, "x-mbx-used-weight: ") + 19) - (StringInStr($sHeaders, "x-mbx-used-weight: ") + 19)) Local $sAPI_IPBan_RetryAfter_Sec = StringInStr($sHeaders, "Retry-After: ") = 0 ? "" : StringMid($sHeaders, StringInStr($sHeaders, "Retry-After: ") + 13, StringInStr($sHeaders, @CR, 0, 1, StringInStr($sHeaders, "Retry-After: ") + 13) - (StringInStr($sHeaders, "Retry-After: ") + 13)) ;----- Get Data ----- Global $sData = "" Local $iBytesToRead, $hBuffer_Data While 1 ;- Get Bytes To Read In This Loop - $iBytesToRead = DllCall($hDll_WinHTTP, "bool", "WinHttpQueryDataAvailable", "handle", $hHTTP_Request, "dword*", 0)[2] ;- Check If No More Data To Read - If $iBytesToRead <= 0 Then ExitLoop ;- Prep Data Buffer - $hBuffer_Data = DllStructCreate("char[" & $iBytesToRead & "]") ;- Read Data To Buffer - DllCall($hDll_WinHTTP, "bool", "WinHttpReadData", "handle", $hHTTP_Request, "struct*", $hBuffer_Data, "dword", $iBytesToRead, "dword*", 0) ;- Get Data From Buffer - $sData &= DllStructGetData($hBuffer_Data, 1) ;- Release - $hBuffer_Data = "" WEnd ;----- Close Handles ----- DllCall($hDll_WinHTTP, "bool", "WinHttpCloseHandle", "handle", $hHTTP_Request) DllCall($hDll_WinHTTP, "bool", "WinHttpCloseHandle", "handle", $hHTTP_Connection) DllCall($hDll_WinHTTP, "bool", "WinHttpCloseHandle", "handle", $hHTTP_Session) ;----- Return Data ----- ; Include HTTP Code and API Weight to check for overuse, and retry period if banned ; HTTP CODES : 429=over request limit, 418=IP banned due to overuse ; API WEIGHT : over 1200 will lead to ban Return '{"HTTPCode":"' & $sHTTP_ReturnCode & '","APIWeight":"' & $sAPI_Weight & ($sAPI_IPBan_RetryAfter_Sec = "" ? "" : '","Retry-After":"' & $sAPI_IPBan_RetryAfter_Sec) & '"}' & $sData EndFunc ;==>_BINANCE_API_Call_api_v3 Func _HMAC($bData, $bKey) ;************************************************** ; Create HMAC SHA256 Signature ;************************************************** Local $oHMAC = ObjCreate("System.Security.Cryptography.HMAC" & "SHA256") $oHMAC.key = Binary($bKey) Local $bHash = $oHMAC.ComputeHash_2(Binary($bData)) Return StringLower(StringMid($bHash, 3)) EndFunc ;==>_HMAC Func _TimeStamp() ;************************************************** ; Create UNIX-style TimeStamp ;************************************************** ; This is 'unix time', aka UTC time in milliseconds Local $aTimeStamp = DllCall("msvcrt.dll", "int:cdecl", "time", "int", 0) Return($aTimeStamp[0] * 1000) + @MSEC ;convert to miliseconds EndFunc ;==>_TimeStamp ; _BINANCE_API_Call_api_all01("api.binance.com","api/v3/time") ; v5 = api-testnet.bybit.com v3 = "api.binance.com" v1 = "fapi.binance.com" Func _BINANCE_API_Call_api_all01($host_api00="api-testnet.bybit.com", $sEndPoint = "", $sParameters = "") ; v5 = api-testnet.bybit.com v3 = "api.binance.com" v1 = "fapi.binance.com" ;************************************************** ; Performs Binance API Call Via Native WinHTTP dll ;************************************************** ;----- Vars ----- ; Presume GET, assign POST if needed in switch Local $sGETorPOST = "GET" ;----- Check Endpoint Required ----- ; Some endpoints require signing, other endpoints can be ; added as new cases. Switch $sEndPoint Case "api/v3/account" $sParameters &= "×tamp=" & _TimeStamp() $sParameters &= "&signature=" & _HMAC($sParameters, $sAPI_Key_Secret) Case "api/v3/order" $sGETorPOST = "POST" $sParameters &= "×tamp=" & _TimeStamp() $sParameters &= "&signature=" & _HMAC($sParameters, $sAPI_Key_Secret) Case "api/v3/myTrades" $sParameters &= "×tamp=" & _TimeStamp() $sParameters &= "&signature=" & _HMAC($sParameters, $sAPI_Key_Secret) EndSwitch ;----- Start Session ----- Local $hHTTP_Session = DllCall($hDll_WinHTTP, "handle", "WinHttpOpen", "wstr", "Mozilla/4.0", "dword", 0, "wstr", "", "wstr", "", "dword", 0)[0] ;----- Connect To Binance Server ----- Local $hHTTP_Connection = DllCall($hDll_WinHTTP, "handle", "WinHttpConnect", "handle", $hHTTP_Session, "wstr", $host_api00, "dword", 443, "dword", 0)[0] ;----- Prepare Request Data ----- If $sParameters <> "" Then $sParameters = "?" & $sParameters Local $hHTTP_Request = DllCall($hDll_WinHTTP, "handle", "WinHttpOpenRequest", "handle", $hHTTP_Connection, "wstr", $sGETorPOST, "wstr", $sEndPoint & $sParameters, "wstr", "HTTP/1.1", "wstr", "", "ptr", 0, "dword", 0x00800000)[0] ;----- Add Request Header ----- ; Adds API key to header even if not specifically needed, inconsequential DllCall($hDll_WinHTTP, "bool", "WinHttpAddRequestHeaders", "handle", $hHTTP_Request, "wstr", "X-MBX-APIKEY: " & $sAPI_Key_Access, "dword", -1, "dword", 0x10000000) ;----- Send Request To Server ----- DllCall($hDll_WinHTTP, "bool", "WinHttpSendRequest", "handle", $hHTTP_Request, "wstr", "", "dword", 0, "ptr", 0, "dword", 0, "dword", 0, "dword_ptr", 0) ;----- Recieve Response ----- DllCall($hDll_WinHTTP, "bool", "WinHttpReceiveResponse", "handle", $hHTTP_Request, "ptr", 0) ;----- Recieve Headers ----- ; Extract HTTP return code and API weight Local $sHeaders = DllCall($hDll_WinHTTP, "bool", "WinHttpQueryHeaders", "handle", $hHTTP_Request, "dword", 22, "wstr", "", "wstr", "", "dword*", 65536, "dword*", 0)[4] Global $sHTTP_ReturnCode = StringMid($sHeaders, StringInStr($sHeaders, "HTTP/1.1 ") + 9, StringInStr($sHeaders, @CR, 0, 1, StringInStr($sHeaders, "HTTP/1.1 ") + 9) - (StringInStr($sHeaders, "HTTP/1.1 ") + 9)) Global $sAPI_Weight = StringMid($sHeaders, StringInStr($sHeaders, "x-mbx-used-weight: ") + 19, StringInStr($sHeaders, @CR, 0, 1, StringInStr($sHeaders, "x-mbx-used-weight: ") + 19) - (StringInStr($sHeaders, "x-mbx-used-weight: ") + 19)) Local $sAPI_IPBan_RetryAfter_Sec = StringInStr($sHeaders, "Retry-After: ") = 0 ? "" : StringMid($sHeaders, StringInStr($sHeaders, "Retry-After: ") + 13, StringInStr($sHeaders, @CR, 0, 1, StringInStr($sHeaders, "Retry-After: ") + 13) - (StringInStr($sHeaders, "Retry-After: ") + 13)) ;----- Get Data ----- Global $sData = "" Local $iBytesToRead, $hBuffer_Data While 1 ;- Get Bytes To Read In This Loop - $iBytesToRead = DllCall($hDll_WinHTTP, "bool", "WinHttpQueryDataAvailable", "handle", $hHTTP_Request, "dword*", 0)[2] ;- Check If No More Data To Read - If $iBytesToRead <= 0 Then ExitLoop ;- Prep Data Buffer - $hBuffer_Data = DllStructCreate("char[" & $iBytesToRead & "]") ;- Read Data To Buffer - DllCall($hDll_WinHTTP, "bool", "WinHttpReadData", "handle", $hHTTP_Request, "struct*", $hBuffer_Data, "dword", $iBytesToRead, "dword*", 0) ;- Get Data From Buffer - $sData &= DllStructGetData($hBuffer_Data, 1) ;- Release - $hBuffer_Data = "" WEnd ;----- Close Handles ----- DllCall($hDll_WinHTTP, "bool", "WinHttpCloseHandle", "handle", $hHTTP_Request) DllCall($hDll_WinHTTP, "bool", "WinHttpCloseHandle", "handle", $hHTTP_Connection) DllCall($hDll_WinHTTP, "bool", "WinHttpCloseHandle", "handle", $hHTTP_Session) ;----- Return Data ----- ; Include HTTP Code and API Weight to check for overuse, and retry period if banned ; HTTP CODES : 429=over request limit, 418=IP banned due to overuse ; API WEIGHT : over 1200 will lead to ban Local $return[4] $return[0] = 'HTTP CODES : 429=over request limit, 418=IP banned due to overuse' & 'API WEIGHT : over 1200 will lead to ban' $return[1] = '{"HTTPCode":"' & $sHTTP_ReturnCode & '","APIWeight":"' & $sAPI_Weight & ($sAPI_IPBan_RetryAfter_Sec = "" ? "" : '","Retry-After":"' & $sAPI_IPBan_RetryAfter_Sec) & '"}' $return[2] = $sData Return $return ;Return '{"HTTPCode":"' & $sHTTP_ReturnCode & '","APIWeight":"' & $sAPI_Weight & ($sAPI_IPBan_RetryAfter_Sec = "" ? "" : '","Retry-After":"' & $sAPI_IPBan_RetryAfter_Sec) & '"}' & $sData EndFunc ;==>_BINANCE_API_Call_api_v3 ; Hàm chuyển đổi ngày giờ từ định dạng MM/DD/YYYY HH:MM:SS sang timestamp (milliseconds) Func ConvertToBinanceTimestamp($sDateTime) ; Phân tách ngày giờ Local $aDateTime = ParseDateTime($sDateTime) Local $year = $aDateTime[0] Local $month = $aDateTime[1] Local $day = $aDateTime[2] Local $hour = $aDateTime[3] - 7 ; Trừ 7 giờ để chuyển từ giờ Việt Nam (UTC+7) sang giờ Binance (UTC) Local $minute = $aDateTime[4] Local $second = $aDateTime[5] ; Xử lý nếu giờ trở thành âm (trường hợp lùi ngày) If $hour < 0 Then $hour += 24 $day -= 1 ; Giảm ngày đi 1 EndIf ; Tạo chuỗi ngày giờ chuẩn UTC Local $formattedDateTime = StringFormat("%04d/%02d/%02d %02d:%02d:%02d", $year, $month, $day, $hour, $minute, $second) Local $baseDate = "1970/01/01 00:00:00" ; Ngày bắt đầu Epoch Return _DateDiff("S", $baseDate, $formattedDateTime) * 1000 ; Chuyển sang milliseconds EndFunc ; Hàm tách ngày giờ từ định dạng MM/DD/YYYY HH:MM:SS Func ParseDateTime($sDateTime) Local $aParts = StringSplit($sDateTime, " ") ; Tách ngày và giờ Local $sDate = $aParts[1] Local $sTime = $aParts[2] Local $aDate = StringSplit($sDate, "/") ; Phân tách ngày (MM/DD/YYYY) Local $aTime = StringSplit($sTime, ":") ; Phân tách giờ (HH:MM:SS) Local $result[6] $result[0] = $aDate[3] ; Năm $result[1] = $aDate[1] ; Tháng $result[2] = $aDate[2] ; Ngày $result[3] = $aTime[1] ; Giờ $result[4] = $aTime[2] ; Phút $result[5] = $aTime[3] ; Giây Return $result EndFunc ; Thời gian đầu vào (giờ Việt Nam - UTC+7) ; Thời gian đầu vào Local $sStartDateTime = "3/22/2025 21:00:00" ; Giờ Việt Nam (UTC+7) Local $sEndDateTime = "3/22/2025 21:22:45" ; Giờ Việt Nam (UTC+7) ; Cấu hình Local $symbol = "BTCUSDT" ; Cặp giao dịch Local $limit = 10 ; Số lượng kết quả tối đa ; Chuyển đổi sang timestamp Binance (UTC) Local $startTime = ConvertToBinanceTimestamp($sStartDateTime) Local $endTime = ConvertToBinanceTimestamp($sEndDateTime) ; Hiển thị kết quả ConsoleWrite("Binance Timestamp (UTC): " & $startTime & @CRLF) ConsoleWrite("Binance Timestamp (UTC): " & $endTime & @CRLF) ConsoleWrite("https://fapi.binance.com/fapi/v1/fundingRate?symbol=" & $symbol & "&startTime=" & $startTime & "&endTime=" & $endTime & @CRLF) Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Func auto_msi01() ; $login_e00 $MSI_Afterburner01 = ProcessList("MSIAfterburner.exe") $msi_run01 = 0 For $i = 1 To $MSI_Afterburner01[0][0] ; MsgBox($MB_SYSTEMMODAL, "", $MSI_Afterburner01[$i][0] & @CRLF & "PID: " &$MSI_Afterburner01[$i][1]) If $MSI_Afterburner01[$i][0] = "MSIAfterburner.exe" Then $msi_run01 = 1 ExitLoop EndIf Next If $msi_run01 = 0 Then Run("C:\Program Files (x86)\MSI Afterburner\MSIAfterburner.exe", "", @SW_SHOWMAXIMIZED) ConsoleWrite("$MSI_Afterburner01 = "&$MSI_Afterburner01&" $msi_run01 = "&$msi_run01&@CRLF) EndFunc