code: def generate_portfolio(
      num_instruments: int,
      market_data: datatypes.OptionMarketData,
      start_instrument_id: int = 0,
  ) -> datatypes.OptionBatch:
      """Generates a random portfolio."""
      underlier_ids = np.random.choice(
          market_data.underlier_id, size=num_instruments
      )
      # Choose strikes to be within +/- 40% of the spot.
      call_put_flags = np.random.rand(num_instruments) > 0.5
      # datetime.date.toordinal uses the same ordinals as tff's dates module.
      today = datetime.date.today().toordinal()
      expiry_date = today + np.random.randint(
          1, high=365 * 10, size=num_instruments
      )
      strike_multipliers = np.random.rand(num_instruments) * 0.8 + 0.6
      underlier_spots = market_data.spot[underlier_ids]
      strikes = underlier_spots * strike_multipliers
      trade_ids = np.arange(num_instruments) + start_instrument_id
      return datatypes.OptionBatch(
          strike=strikes,
          call_put_flag=call_put_flags,
          expiry_date=expiry_date,
          trade_id=trade_ids,
          underlier_id=underlier_ids,
      )
  
file_path: tf-quant-finance/tf_quant_finance/examples/demos/option_pricing_basic/data_generator/data_generation.py
imports: import datetime
  from os import path
  import tempfile
  from typing import Tuple, List
  from absl import app
  from absl import flags
  from absl import logging
  from common import datatypes
  import dataclasses
  import numpy
  import tf_quant_finance
  from google.cloud import storage
label_desc: Use image node_id 3 for calling a global function with example usage: generate_portfolio(num_instruments, market_data, start_instrument_id) and returns: datatypes