code: def default_handle_data(context, data):
      context.curr_minute = data.current_dt
      context.counter += 1
  
      if context.candles_sample_rate == 1:
          context.i += 1
      elif context.counter % context.candles_sample_rate != 0:
          context.i += 1
          return
  
      if context.i < context.parameters.SKIP_FIRST_CANDLES:
          return
  
      context.candles_open = data.history(
          context.coin_pair,
          "open",
          bar_count=context.candles_buffer_size,
          frequency=context.candles_frequency,
      )
      context.candles_high = data.history(
          context.coin_pair,
          "high",
          bar_count=context.candles_buffer_size,
          frequency=context.candles_frequency,
      )
      context.candles_low = data.history(
          context.coin_pair,
          "low",
          bar_count=context.candles_buffer_size,
          frequency=context.candles_frequency,
      )
      context.candles_close = data.history(
          context.coin_pair,
          "price",
          bar_count=context.candles_buffer_size,
          frequency=context.candles_frequency,
      )
      context.candles_volume = data.history(
          context.coin_pair,
          "volume",
          bar_count=context.candles_buffer_size,
          frequency=context.candles_frequency,
      )
  
      # FIXME: Here is the error!
      # The candles_close frame shows more or less always a value of 94, while
      # bitcoin price is very different from that
      print(context.candles_close)
  
      context.base_prices = context.candles_close
      cash = context.portfolio.cash
      amount = context.portfolio.positions[context.coin_pair].amount
      price = data.current(context.coin_pair, "price")
      # order_id = None
      context.last_base_price = context.base_prices[-2]
      context.curr_base_price = context.base_prices[-1]
  
      # TA calculations
      # ...
  
      # Sanity checks
      # assert cash >= 0
      if cash < 0:
          import ipdb
  
          ipdb.set_trace()  # BREAKPOINT
  
      print_facts(context)
      print_facts_telegram(context)
  
      # Order management
      # net_shares = 0
      if context.counter == 2:
          pass
          brute_shares = (
              cash / price
          ) * context.parameters.BUY_PERCENTAGE
          share_commission_fee = (
              brute_shares * context.parameters.COMMISSION_FEE
          )
          net_shares = brute_shares - share_commission_fee
          buy_order_id = order(context.coin_pair, net_shares)
          print(buy_order_id)
  
      if context.counter == 3:
          pass
          brute_shares = amount * context.parameters.SELL_PERCENTAGE
          share_commission_fee = (
              brute_shares * context.parameters.COMMISSION_FEE
          )
          net_shares = -(brute_shares - share_commission_fee)
          sell_order_id = order(context.coin_pair, net_shares)
          print(sell_order_id)
  
      # Record
      record(
          price=price,
          foo="bar",
          # volume=current['volume'],
          # price_change=price_change,
          # Metrics
          cash=cash,
          # buy=context.buy,
          # sell=context.sell
      )
  
file_path: catalyst/catalyst/support/issue_216.py
imports: import sys
  import os
  import signal
  import pandas
  from logbook import Logger
  from catalyst import run_algorithm
  from catalyst.api import symbol, record, order
  from catalyst.finance import commission
label_desc: Use image node_id 4 for calling a global function with example usage: default_handle_data(context, data) without return types