Loading ...

币安交易终端资金划转插件

Author: makebit, Date: 2021-01-12 16:46:04
Tags:


var type = [1,2,3,4][typeIndex]

function UsdtTransfer( e , cur , amount , type ){
    try {
        var base = ''
        var params = ''
        var 币种 = cur
        var 划转数量 = amount
        var exname = e.GetName()
        if( exname == 'Binance'){
			// 1: 现货账户向USDT合约账户划转 
			// 2: USDT合约账户向现货账户划转
			// 3: 现货账户向币本位合约账户划转 
			// 4: 币本位合约账户向现货账户划转
            var 划转类型 = type
            //划转到现货
            //POST /sapi/v1/futures/transfer
            base = "https://api.binance.com"
            e.SetBase(base)
            var timestamp = new Date().getTime() 
            params = "asset="+币种+"&amount="+划转数量+"&type="+划转类型+"&timestamp"+timestamp
            // params ={
            //     "asset": 币种 , 
            //     "amount": 划转数量, 
            //     "type" : 划转类型,
            //     "timestamp" : new Date().getTime()    
			// }
			Log( "交易对:",币种,"划转数量:",划转数量,"划转类型:",划转类型)
            //var ret1 = e.IO("api", "POST", "/sapi/v1/futures/transfer" ,"",  JSON.stringify( params ) )
            var ret1 = e.IO("api", "POST", "/sapi/v1/futures/transfer" , params )
			Log(ret1)
        }
        else if( exname == 'Futures_Binance'){
			// 1: 现货账户向USDT合约账户划转 
			// 2: USDT合约账户向现货账户划转
			// 3: 现货账户向币本位合约账户划转 
			// 4: 币本位合约账户向现货账户划转
            var 划转类型 = type
            //划转到现货
            //POST /sapi/v1/futures/transfer
            base = "https://api.binance.com"
            e.SetBase(base)
            var timestamp = new Date().getTime() 
            params = "asset="+币种+"&amount="+划转数量+"&type="+划转类型+"&timestamp"+timestamp
            // params ={
            //     "asset": 币种 , 
            //     "amount": 划转数量, 
            //     "type" : 划转类型,
            //     "timestamp" : new Date().getTime()    
			// }
			Log( "交易对:",币种,"划转数量:",划转数量,"划转类型:",划转类型)
            //var ret1 = e.IO("api", "POST", "/sapi/v1/futures/transfer" ,"",  JSON.stringify( params ) )
            var ret1 = e.IO("api", "POST", "/sapi/v1/futures/transfer" , params )
            Log(ret1)
            base = "https://fapi.binance.com"
            e.SetBase(base)
            return ret1
        }
    } catch (error) { 
        Log( error )
    }  
}

function main() {
    UsdtTransfer( exchange , assets , amount , type )
}

More