🎮Core
Command (Abstract Base Class)
Description: The
Command
class is an abstract base class (ABC) that defines the interface for all commands in the DSL.Constructor Parameters: None
Methods:
execute(self, data_provider)
: An abstract method that must be implemented by any subclass. This method will act on the command using the provideddata_provider
.
Open_Command
Retrieves the opening price of a market instrument for a specified date.
Constructor Parameters:
date (str)
: The date for which the open price is to be fetched.
Methods:
execute(self, data_provider)
: Callsdata_provider.get_open(self.date)
to retrieve the opening price for the specified date.
Example Usage:
open_command = OpenCommand(date="2023-09-02")
open_price = open_command.execute(data_provider)
High_Command
Retrieves the highest price of a market instrument for a specified date.
Constructor Parameters:
date (str)
: The date for which the high price is to be fetched.
Methods:
execute(self, data_provider)
: Callsdata_provider.get_high(self.date)
to retrieve the highest price for the specified date.
Example Usage:
high_command = HighCommand(date="2023-09-02")
high_price = high_command.execute(data_provider)
Low_Command
Retrieves the lowest price of a market instrument for a specified date.
Constructor Parameters:
date (str)
: The date for which the low price is to be fetched.
Methods:
execute(self, data_provider)
: Callsdata_provider.get_low(self.date)
to retrieve the lowest price for the specified date.
Example Usage:
low_command = LowCommand(date="2023-09-02")
low_price = low_command.execute(data_provider)
Close_Command
Retrieves the closing price of a market instrument for a specified date.
Constructor Parameters:
date (str)
: The date for which the close price is to be fetched.
Methods:
execute(self, data_provider)
: Callsdata_provider.get_close(self.date)
to retrieve the closing price for the specified date.
Example Usage:
close_command = CloseCommand(date="2023-09-02")
close_price = close_command.execute(data_provider)
Last updated