Bardo.Examples.Applications.Fx.FxSensor (Bardo v0.1.0)

View Source

Sensor implementation for the Forex (FX) trading application.

This module provides sensors that agents can use to perceive forex market data, including:

  • Price Chart Image (PCI): 2D grid representation of price movement
  • Price List Information (PLI): Normalized vector of recent prices
  • Internals: Current trading position information

Summary

Functions

Initialize a new sensor for FX trading.

Creates an Internals sensor configuration for tracking account state.

Creates a Price Chart Image (PCI) sensor configuration.

Process sensory data based on sensor type.

Creates a Price List Information (PLI) sensor configuration.

Read data from the sensor.

Send a sensing request to the scape.

Cleanup resources when terminating.

Functions

init(params)

Initialize a new sensor for FX trading.

This is the implementation of the Sensor behavior's init/1 callback.

init(id, sensor_type, params, fanout, cortex_pid, scape_pid, agent_id)

Initialize a new sensor for FX trading.

Parameters:

  • id: Sensor ID
  • sensor_type: :pci, :pli, or :internals
  • params: Configuration parameters for the sensor
  • fanout: Number of output elements
  • cortex_pid: PID of the cortex process
  • scape_pid: PID of the scape process
  • agent_id: ID of the agent

internals(size, cortex_id, scape_name)

@spec internals(pos_integer(), binary() | atom(), atom()) :: map()

Creates an Internals sensor configuration for tracking account state.

Parameters

  • size - The number of internal account state variables to track
  • cortex_id - The ID of the cortex this sensor is connected to
  • scape_name - The name of the scape this sensor will read from

Returns

  • A sensor specification map

pci(dimension, timeframe, cortex_id, scape_name)

@spec pci(pos_integer(), pos_integer(), binary() | atom(), atom()) :: map()

Creates a Price Chart Image (PCI) sensor configuration.

Parameters

  • dimension - The dimension size of the price chart grid
  • timeframe - The number of time periods to consider
  • cortex_id - The ID of the cortex this sensor is connected to
  • scape_name - The name of the scape this sensor will read from

Returns

  • A sensor specification map

percept(sensor_type, arg)

Process sensory data based on sensor type.

This is the implementation of the Sensor behavior's percept/2 callback.

pli(count, period, cortex_id, scape_name)

@spec pli(pos_integer(), pos_integer(), binary() | atom(), atom()) :: map()

Creates a Price List Information (PLI) sensor configuration.

Parameters

  • count - The number of price points to consider
  • period - The time period between price points
  • cortex_id - The ID of the cortex this sensor is connected to
  • scape_name - The name of the scape this sensor will read from

Returns

  • A sensor specification map

read(state)

Read data from the sensor.

This function sends a sensing request to the scape and processes the response.

sense(sensor_type, arg)

Send a sensing request to the scape.

This is the implementation of the Sensor behavior's sense/2 callback.

terminate(reason, mod_state)

Cleanup resources when terminating.