三行代码  ›  专栏  ›  技术社区  ›  Christina Norwood

我需要什么Python技术来获取二进制边距数据?

  •  0
  • Christina Norwood  · 技术社区  · 1 月前

    我想获得本页列出的所有硬币的单独保证金账户中的借款限额 https://www.binance.com/en/margin-fee

    1 回复  |  直到 1 月前
        1
  •  1
  •   Adarsh Raj    1 月前

    下面是获取此数据的隔离边缘Vip级API的简单代码

    maxBorrowable":"19800000.00000000","interestRate":"0.00006800"},{"level":"9","maxBorrowable":"27500000.00000000","interestRate":"0.00006375"}],"custom":null},"quote":{"assetName":"USDT","levelDetails":[{"level":"0","maxBorrowable":"3000.00000000","interestRate":"0.00020000"},{"level":"1","maxBorrowable":"12000.00000000","interestRate":"0.00019000"},{"level":"2","maxBorrowable":"18000.00000000","interestRate":"0.00011000"},{"level":"3","maxBorrowable":"24000.00000000","interestRate":"0.00008000"},{"level":"4","maxBorrowable":"36000.00000000","interestRate":"0.00008000"},{"level":"5","maxBorrowable":"36000.00000000","interestRate":"0.00006000"},{"level":"6","maxBorrowable":"36000.00000000","interestRate":"0.00006000"},{"level":"7","maxBorrowable":"60000.00000000","interestRate":"0.00004000"},{"level":"8","maxBorrowable":"60000.00000000","interestRate":"0.00003000"},{"level":"9","maxBorrowable":"60000.00000000","interestRate":"0.00003000"}],"custom":null},"symbol":"DOGEUSDT"},{"marginRatio":"10.00000000","base":{"assetName":"DOT","levelDetails":[{"level":"0","maxBorrowable":"8000.00000000","interestRate":"0.00040000"},{"level":"1","maxBorrowable":"24000.00000000","interestRate":"0.00032300"},{"level":"2","maxBorrowable":"36000.00000000","interestRate":"0.00032300"},{"level":"3","maxBorrowable":"48000.00000000","interestRate":"0.00030600"},{"level":"4","maxBorrowable":"60000.00000000","interestRate":"0.00030600"},{"level":"5","maxBorrowable":"96000.00000000","interestRate":"0.00028800"},{"level":"6","maxBorrowable":"96000.00000000","interestRate":"0.00027200"},{"level":"7","maxBorrowable":"96000.00000000","interestRate":"0.00027200"},{"level":"8","maxBorrowable":"96000.00000000","interestRate":"0.00025600"},{"level":"9","maxBorrowable":"120000.00000000","interestRate":"0.00024000"}],"custom":null},"quote":{"assetName":"BTC","levelDetails":[{"level":"0","maxBorrowable":"3.20000000","interestRate":"0.00010000"},{"level":"1","maxBorrowable":"9.60000000","interestRate":"0.00008075"},{"level":"2","maxBorrowable":"14.40000000","interestRate":"0.00004675"},{"level":"3","maxBorrowable":"19.20000000","interestRate":"0.00003400"},{"level":"4","maxBorrowable":"19.20000000","interestRate":"0.00003400"},{"level":"5","maxBorrowable":"32.00000000","interestRate":"0.00002400"},{"level":"6","maxBorrowable":"32.00000000","interestRate":"0.00002400"},{"level":"7","maxBorrowable":"51.20000000","interestRate":"0.00002160"},{"level":"8","maxBorrowable":"57.60000000","interestRate":"0.00001760"},{"level":"9","maxBorrowable":"80.00000000","interestRate":"0.00001650"}],"custom":null},"symbol":"DOTBTC"},{"marginRatio":"5.00000000","base":{"assetName":"DOT","levelDetails":[{"level":"0","maxBorrowable":"12600.00000000","interestRate":"0.00040000"},{"level":"1","maxBorrowable":"37800.00000000","interestRate":"0.00032300"},{"level":"2","maxBorrowable":"56700.00000000","interestRate":"0.00032300"},{"level":"3","maxBorrowable":"75600.00000000","interestRate":"0.00030600"},{"level":"4","maxBorrowable":"94500.00000000","interestRate":"0.00030600"},{"level":"5","maxBorrowable":"151200.00000000","interestRate":"0.00028800"},{"level":"6","maxBorrowable":"151200.00000000","interestRate":"0.00027200"},{"level":"7","maxBorrowable":"151200.00000000","interestRate":"0.00027200"},{"level":"8","maxBorrowable":"151200.00000000","interestRate":"0.00025600"},{"level":"9","maxBorrowable":"189000.00000000","interestRate":"0.00024000"}],"custom":null},"quote":{"assetName":"BUSD","levelDetails":[{"level":"0","maxBorrowable":"210895.00000000","interestRate":"0.00020000"},{"level":"1","maxBorrowable":"632685.00000000","interestRate":"0.00016150"},{"level":"2","maxBorrowable":"949027.50000000","interestRate":"0.00009350"},{"level":"3","maxBorrowable":"1265370.00000000","interestRate":"0.00006800"},{"level":"4","maxBorrowable":"1581712.50000000","interestRate":"0.00006800"},{"level":"5","maxBorrowable":"2530740.00000000","interestRate":"0.00004800"},{"level":"6","maxBorrowable":"2952530.00000000","interestRate":"0.00004800"},{"level":"7","maxBorrowable":"3374320.00000000","interestRate":"0.00003200"},{"level":"8","maxBorrowable":"3796110.00000000","interestRate":"0.00002400"},{"level":"9","maxBorrowable":"5272375.00000000","interestRate":"0.00002250"}],"custom":null},"symbol":"DOTBUSD"},{"marginRatio":"10.00000000","base":{"assetName":"DOT","levelDetails":[{"level":"0","maxBorrowable":"14400.00000000","interestRate":"0.00040000"},{"level":"1","maxBorrowable":"43200.00000000","interestRate":"0.00032300"},{"level":"2","maxBorrowable":"64800.00000000","interestRate":"0.00032300"},{"level":"3","maxBorrowable":"86400.00000000","interestRate":"0.00030600"},{"level":"4","maxBorrowable":"108000.00000000","interestRate":"0.00030600"},{"level":"5","maxBorrowable":"172800.00000000","interestRate":"0.00028800"},{"level":"6","maxBorrowable":"172800.00000000","interestRate":"0.00027200"},{"level":"7","maxBorrowable":"172800.00000000","interestRate":"0.00027200"},{"level":"8","maxBorrowable":"172800.00000000","interestRate":"0.00025600"},{"level":"9","maxBorrowable":"216000.00000000","interestRate":"0.00024000"}],"custom":null},"quote":{"assetName":"USDT","levelDetails":[{"level":"0","maxBorrowable":"60000.00000000","interestRate":"0.00020000"},{"level":"1","maxBorrowable":"240000.00000000","interestRate":"0.00019000"},{"level":"2","maxBorrowable":"360000.00000000","interestRate":"0.00011000"},{"level":"3","maxBorrowable":"480000.00000000","interestRate":"0.00008000"},{"level":"4","maxBorrowable":"720000.00000000","interestRate":"0.00008000"},{"level":"5","maxBorrowable":"720000.00000000","interestRate":"0.00006000"},{"level":"6","maxBorrowable":"720000.00000000","interestRate":"0.00006000"},{"level":"7","maxBorrowable":"1200000.00000000","interestRate":"0.00004000"},{"level":"8","maxBorrowable":"1200000.00000000","interestRate":"0.00003000"},{"level":"9","maxBorrowable":"1200000.00000000","interestRate":"0.00003000"}],"custom":null},"symbol":"DOTUSDT"},{"marginRatio":"3.00000000","base":{"assetName":"DREP","levelDetails":[{"level":"0","maxBorrowable":"1200.00000000","interestRate":"0.00020000"},{"level":"1","maxBorrowable":"2400.00000000","interestRate":"0.00019000"},{"level":"2","maxBorrowable":"3600.00000000","interestRate":"0.00019000"},{"level":"3","maxBorrowable":"4800.00000000","interestRate":"0.00018000"},{"level":"4","maxBorrowable":"6000.00000000","interestRate":"0.00018000"},{"level":"5","maxBorrowable":"7200.00000000","interestRate":"0.00018000"},{"level":"6","maxBorrowable":"7200.00000000","interestRate":"0.00017000"},{"level":"7","maxBorrowable":"7200.00000000","interestRate":"0.00017000"},{"level":"8","maxBorrowable":"7200.00000000","interestRate":"0.00016000"},{"level":"9","maxBorrowable":"7200.00000000","interestRate":"0.00016000"}],"custom":null},"quote":{"assetName":"BTC","levelDetails":[{"level":"0","maxBorrowable":"0.50000000","interestRate":"0.00010000"},{"level":"1","maxBorrowable":"1.50000000","interestRate":"0.00008075"},{"level":"2","maxBorrowable":"2.25000000","interestRate":"0.00004675"},{"level":"3","maxBorrowable":"3.00000000","interestRate":"0.00003400"},{"level":"4","maxBorrowable":"3.00000000","interestRate":"0.00003400"},{"level":"5","maxBorrowable":"5.00000000","interestRate":"0.00002400"},{"level":"6","maxBorrowable":"5.00000000","interestRate":"0.00002400"},{"level":"7","maxBorrowable":"8.00000000","interestRate":"0.00002160"},{"level":"8","maxBorrowable":"9.00000000","interestRate":"0.00001760"},{"level":"9","maxBorrowable":"12.50000000","interestRate":"0.00001650"}],"custom":null},"symbol":"DREPBTC"},{"marginRatio":"3.00000000","base":{"assetName":"DREP","levelDetails":[{"level":"0","maxBorrowable":"1875.00000000","interestRate":"0.00020000"},{"level":"1","maxBorrowable":"3750.00000000","interestRate":"0.00019000"},{"level":"2","maxBorrowable":"5625.00000000","interestRate":"0.00019000"},{"level":"3","maxBorrowable":"7500.00000000","interestRate":"0.00018000"},{"level":"4","maxBorrowable":"9375.00000000","interestRate":"0.00018000"},{"level":"5","maxBorrowable":"11250.00000000","interestRate":"0.00018000"},{"level":"6","maxBorrowable":"11250.00000000","interestRate":"0.00017000"},{"level":"7","maxBorrowable":"11250.00000000","interestRate":"0.00017000"},{"level":"8","maxBorrowable":"11250.00000000","interestRate":"0.00016000"},{"level":"9","maxBorrowable":"11250.00000000","interestRate":"0.00016000"}],"custom":null},"quote":{"assetName":"USDT","levelDetails":[{"level":"0","maxBorrowable":"4500.00000000","interestRate":"0.00020000"},{"level":"1","maxBorrowable":"18000.00000000","interestRate":"0.00019000"},{"level":"2","maxBorrowable":"27000.00000000","interestRate":"0.00011000"},{"level":"3","maxBorrowable":"36000.00000000","interestRate":"0.00008000"},{"level":"4","maxBorrowable":"54000.00000000","interestRate":"0.00008000"},{"level":"5","maxBorrowable":"54000.00000000","interestRate":"0.00006000"},{"level":"6","maxBorrowable":"54000.00000000","interestRate":"0.00006000"},{"level":"7","maxBorrowable":"90000.00000000","interestRate":"0.00004000"},{"level":"8","maxBorrowable":"90000.00000000","interestRate":"0.00003000"},{"level":"9","maxBorrowable":"90000.00000000","interestRate":"0.00003000"}],"custom":null},"symbol":"DREPUSDT"},{"marginRatio":"3.00000000","base":{"assetName":"DUSK","levelDetails":[{"level":"0","maxBorrowable":"19800.00000000","interestRate":"0.00080000"},{"level":"1","maxBorrowable":"39600.00000000","interestRate":"0.00076000"},{"level":"2","maxBorrowable":"59400.00000000","interestRate":"0.00076000"},{"level":"3","maxBorrowable":"79200.00000000","interestRate":"0.00072000"},{"level":"4","maxBorrowable":"99000.00000000","interestRate":"0.00072000"},{"level":"5","maxBorrowable":"118800.00000000","interestRate":"0.00072000"},{"level":"6","maxBorrowable":"118800.00000000","interestRate":"0.00068000"},{"level":"7","maxBorrowable":"118800.00000000","interestRate":"0.00068000"},{"level":"8","maxBorrowable":"118800.00000000","interestRate":"0.00064000"},{"level":"9","maxBorrowable":"118800.00000000","interestRate":"0.00064000"}],"custom":null},"quote":{"assetName":"BTC","levelDetails":[{"level":"0","maxBorrowable":"0.10000000","interestRate":"0.00010000"},{"level":"1","maxBorrowable":"0.30000000","interestRate":"0.00008075"},{"level":"2","maxBorrowable":"0.45000000","interestRate":"0.00004675"},{"level":"3","maxBorrowable":"0.60000000","interestRate":"0.00003400"},{"level":"4","maxBorrowable":"0.60000000","interestRate":"0.00003400"},{"level":"5","maxBorrowable":"1.00000000","interestRate":"0.00002400"},{"level":"6","maxBorrowable":"1.00000000","interestRate":"0.00002400"},{"level":"7","maxBorrowable":"1.60000000","interestRate":"0.00002160"},{"level":"8","maxBorrowable":"1.80000000","interestRate":"0.00001760"},{"level":"9","maxBorrowable":"2.50000000","interestRate":"0.00001650"}],"cu
    
    import requests
    from fake_headers import Headers
    
    headers = Headers(
        browser='chrome',
        os='macOS',
        headers=True
    )
    
    url = 'https://www.binance.com/bapi/margin/v1/friendly/isolated-margin/pair/vip-level'
    s = requests.Session()
    s.headers = headers.generate()
    
    main_response = s.get(url)
    print(main_response.text)
    

    userMaxBorrow userMinBorrow 还有更多:

    [{"assetName":"BTC","assetFullName":"Bitcoin","userMaxBorrow":"60.00000000","userMinBorrow":"0.00000000","userMinRepay":"0.00000000","isBorrowable":true,"isMortgageable":true,"isAllowOpenLong":true,"isAllowOpenShort":true,"status":"NORMAL","delistedTime":null},
    
    url = 'https://www.binance.com/bapi/margin/v1/friendly/margin/asset/all'
    

    从这个网址你可以得到利润率

    https://www.binance.com/bapi/margin/v1/public/isolated-margin/pair/listed
    

    没有 fake_headers

    import requests
    
    headers = {'Accept': '*/*', 'Connection': 'keep-alive', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683 Safari/537.36', 'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'en-US;q=0.5,en;q=0.3', 'DNT': '1', 'Upgrade-Insecure-Requests': '1', 'Referer': 'https://google.com'}
    
    url = 'https://www.binance.com/bapi/margin/v1/public/isolated-margin/pair/listed'
    s = requests.Session()
    s.headers = headers
    
    main_response = s.get(url)
    print(main_response.text)
    

    你不需要任何其他额外的技术,你只需要分析他们的网站请求。 requests 假_头