Firetron’s PlaceSpreadOrder

2 898 Views No Comments 4 years ago
  • Creates a spread of orders.

    Custom Command Dependencies:
    None

    Test Script:

    if not Load('done', false) then
    
      local currentPrice = CurrentPrice()[1]
    
      -- Test Long Spread
    
      Log('==================================================')
      Log('Testing Long Spread, CurrentPrice: '..currentPrice)
      Log('==================================================')
    
      local p = {
        amountList   = {1, 2, 3},
        direction    = 'GoLong',
        orderOptions = {
          market = PriceMarket(),
          type   = NoTimeOutOrderType,
          note   = 'Long Spread',
        },
        priceList    = {currentPrice, SubPercentage(currentPrice, 1), SubPercentage(currentPrice, 1)},
      }
    
      local longOrders = CC_PlaceSpreadOrder(p)
    
      for i = 1, #longOrders do
    
        Log('Long Order ID: '..longOrders[i])
    
      end
    
      -- Test Short Spread
    
      Log('==================================================')
      Log('Testing Short Spread, CurrentPrice: '..currentPrice)
      Log('==================================================')
    
      p.direction         = 'GoShort'
      p.orderOptions.note = 'Short Spread'
      p.priceList         = {currentPrice, AddPercentage(currentPrice, 1), AddPercentage(currentPrice, 1)}
    
      local shortOrders = CC_PlaceSpreadOrder(p)
    
      for i = 1, #shortOrders do
    
        Log('Short Order ID: '..shortOrders[i])
    
      end
    
      Save('done', true)
    
    end
    HaasScript Code
    Sign in or Register to download for free
  • Earn Up to $100,000 USDT Promotion Type: contest Expires: June 30, 2024 Exclusive
    Fire up your trade bots and earn up to $100,000 USDT, BitMEX VIP, free subscriptions, and more.
Login or Register to Comment

Unlock your crypto trading potential

Create a free account and enjoy everything we have to offer.

Join for Free