tbapi.api.interfaces.orders.iorder_accessor

 1from __future__ import annotations
 2from typing import TYPE_CHECKING
 3from tbapi.common.decorators import tb_interface
 4from tbapi.common.converters import to_python_datetime, to_net_datetime
 5from datetime import datetime
 6from Tickblaze.Scripts.Api.Interfaces.Orders import IOrderAccessor as _IOrderAccessor
 7from typing import Any, overload
 8from abc import ABC, abstractmethod
 9from tbapi.api.enums.run_type import RunType
10from Tickblaze.Scripts.Api.Enums import RunType as _RunType
11if TYPE_CHECKING:
12    from tbapi.api.interfaces.isymbol import ISymbol
13    from tbapi.api.interfaces.iaccount import IAccount
14    from tbapi.api.interfaces.orders.iposition import IPosition
15
16@tb_interface(_IOrderAccessor)
17class IOrderAccessor():
18    """Provides access to order-related information and functionality within the trading system."""
19
20    @property
21    def symbol(self) -> ISymbol:
22        """The financial symbol associated with the orders and position."""
23        from tbapi.api.interfaces.isymbol import ISymbol
24        val = self._value.Symbol
25        return ISymbol(_existing=val)
26    @property
27    def account(self) -> IAccount:
28        """The account associated with the orders and position."""
29        from tbapi.api.interfaces.iaccount import IAccount
30        val = self._value.Account
31        return IAccount(_existing=val)
32    @property
33    def pending_orders(self) -> IReadOnlyList:
34        """A collection of orders that are currently pending execution."""
35        val = self._value.PendingOrders
36        return val
37    @property
38    def position(self) -> IPosition:
39        """The position associated with the current symbol and account."""
40        from tbapi.api.interfaces.orders.iposition import IPosition
41        val = self._value.Position
42        return IPosition(_existing=val)
43    @property
44    def run_type(self) -> RunType:
45        val = int(self._value.RunType)
46        return RunType(val)
47
48    @abstractmethod
49    def get_exchange_rate(self, from_currency: str, to_currency: str) -> float:
50        """Retrieves the exchange rate for converting one currency to another.            The currency to convert from (e.g., "USD").      The currency to convert to (e.g., "EUR").      The exchange rate between the specified currencies."""
51        result = self._value.GetExchangeRate(from_currency, to_currency)
52        return result
53  
@tb_interface(_IOrderAccessor)
class IOrderAccessor:
22@tb_interface(_IOrderAccessor)
23class IOrderAccessor():
24    """Provides access to order-related information and functionality within the trading system."""
25
26    @property
27    def symbol(self) -> ISymbol:
28        """The financial symbol associated with the orders and position."""
29        from tbapi.api.interfaces.isymbol import ISymbol
30        val = self._value.Symbol
31        return ISymbol(_existing=val)
32    @property
33    def account(self) -> IAccount:
34        """The account associated with the orders and position."""
35        from tbapi.api.interfaces.iaccount import IAccount
36        val = self._value.Account
37        return IAccount(_existing=val)
38    @property
39    def pending_orders(self) -> IReadOnlyList:
40        """A collection of orders that are currently pending execution."""
41        val = self._value.PendingOrders
42        return val
43    @property
44    def position(self) -> IPosition:
45        """The position associated with the current symbol and account."""
46        from tbapi.api.interfaces.orders.iposition import IPosition
47        val = self._value.Position
48        return IPosition(_existing=val)
49    @property
50    def run_type(self) -> RunType:
51        val = int(self._value.RunType)
52        return RunType(val)
53
54    @abstractmethod
55    def get_exchange_rate(self, from_currency: str, to_currency: str) -> float:
56        """Retrieves the exchange rate for converting one currency to another.            The currency to convert from (e.g., "USD").      The currency to convert to (e.g., "EUR").      The exchange rate between the specified currencies."""
57        result = self._value.GetExchangeRate(from_currency, to_currency)
58        return result

Provides access to order-related information and functionality within the trading system.

IOrderAccessor(*args, **kwargs)
199        def __init__(self, *args, **kwargs):
200            pass
26    @property
27    def symbol(self) -> ISymbol:
28        """The financial symbol associated with the orders and position."""
29        from tbapi.api.interfaces.isymbol import ISymbol
30        val = self._value.Symbol
31        return ISymbol(_existing=val)

The financial symbol associated with the orders and position.

32    @property
33    def account(self) -> IAccount:
34        """The account associated with the orders and position."""
35        from tbapi.api.interfaces.iaccount import IAccount
36        val = self._value.Account
37        return IAccount(_existing=val)

The account associated with the orders and position.

pending_orders: 'IReadOnlyList'
38    @property
39    def pending_orders(self) -> IReadOnlyList:
40        """A collection of orders that are currently pending execution."""
41        val = self._value.PendingOrders
42        return val

A collection of orders that are currently pending execution.

43    @property
44    def position(self) -> IPosition:
45        """The position associated with the current symbol and account."""
46        from tbapi.api.interfaces.orders.iposition import IPosition
47        val = self._value.Position
48        return IPosition(_existing=val)

The position associated with the current symbol and account.

run_type: tbapi.api.enums.run_type.RunType
49    @property
50    def run_type(self) -> RunType:
51        val = int(self._value.RunType)
52        return RunType(val)
@abstractmethod
def get_exchange_rate(self, from_currency: str, to_currency: str) -> float:
54    @abstractmethod
55    def get_exchange_rate(self, from_currency: str, to_currency: str) -> float:
56        """Retrieves the exchange rate for converting one currency to another.            The currency to convert from (e.g., "USD").      The currency to convert to (e.g., "EUR").      The exchange rate between the specified currencies."""
57        result = self._value.GetExchangeRate(from_currency, to_currency)
58        return result

Retrieves the exchange rate for converting one currency to another. The currency to convert from (e.g., "USD"). The currency to convert to (e.g., "EUR"). The exchange rate between the specified currencies.