code: def test_valid_sub():
      # Quantity
      q1 = Quantity(BTC, 1000)
      q2 = Quantity(BTC, 500)
      q = q1 - q2
      assert q.size == 500
      assert q.instrument == BTC
  
      # Quantity with Path ID
      q1 = Quantity(BTC, 1000, path_id=path_id)
      q2 = Quantity(BTC, 500)
      q = q1 - q2
      assert q.size == 500
      assert q.instrument == BTC
      assert q.path_id == path_id
  
      # Quantity with matching Path ID
      q1 = Quantity(BTC, 1000, path_id=path_id)
      q2 = Quantity(BTC, 500, path_id=path_id)
      q = q1 - q2
      assert q.size == 500
      assert q.instrument == BTC
      assert q.path_id == path_id
  
      # int
      q1 = Quantity(BTC, 1000)
      q2 = 500
      q = q1 - q2
      assert q.size == 500
      assert q.instrument == BTC
  
      # float
      q1 = Quantity(BTC, 1000)
      q2 = 500.0
      q = q1 - q2
      assert q.size == 500
      assert q.instrument == BTC
  
imports: import pytest
  import unittest.mock
  from tensortrade.oms.instruments import *
  from tensortrade.core.exceptions import *
label_desc: Use image node_id 8 for calling a global function with example usage: test_valid_sub() without return types