Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
Fix some warnings from PyCharm
Browse files Browse the repository at this point in the history
  • Loading branch information
erdewit committed Aug 29, 2023
1 parent de7cd9d commit 1c4c953
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions ib_insync/ib.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,7 @@ def placeOrder(self, contract: Contract, order: Order) -> Trade:
orderStatus = OrderStatus(
orderId=orderId, status=OrderStatus.PendingSubmit)
logEntry = TradeLogEntry(now, orderStatus.status)
trade = Trade(
contract, order, orderStatus, [], [logEntry])
trade = Trade(contract, order, orderStatus, [], [logEntry])
self.wrapper.trades[key] = trade
self._logger.info(f'placeOrder: New order {trade}')
self.newOrderEvent.emit(trade)
Expand Down
17 changes: 9 additions & 8 deletions ib_insync/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,10 @@ class OrderStatus:
Filled: ClassVar[str] = 'Filled'
Inactive: ClassVar[str] = 'Inactive'

DoneStates: ClassVar[Set[str]] = {'Filled', 'Cancelled', 'ApiCancelled'}
ActiveStates: ClassVar[Set[str]] = {
'PendingSubmit', 'ApiPending', 'PreSubmitted', 'Submitted'}
DoneStates: ClassVar[Set[str]] = frozenset(
['Filled', 'Cancelled', 'ApiCancelled'])
ActiveStates: ClassVar[Set[str]] = frozenset(
['PendingSubmit', 'ApiPending', 'PreSubmitted', 'Submitted'])


@dataclass
Expand Down Expand Up @@ -285,18 +286,18 @@ class Trade:
* ``cancelledEvent`` (trade: :class:`.Trade`)
"""

events: ClassVar = (
'statusEvent', 'modifyEvent', 'fillEvent',
'commissionReportEvent', 'filledEvent',
'cancelEvent', 'cancelledEvent')

contract: Contract = field(default_factory=Contract)
order: Order = field(default_factory=Order)
orderStatus: 'OrderStatus' = field(default_factory=OrderStatus)
fills: List[Fill] = field(default_factory=list)
log: List[TradeLogEntry] = field(default_factory=list)
advancedError: str = ''

events: ClassVar = (
'statusEvent', 'modifyEvent', 'fillEvent',
'commissionReportEvent', 'filledEvent',
'cancelEvent', 'cancelledEvent')

def __post_init__(self):
self.statusEvent = Event('statusEvent')
self.modifyEvent = Event('modifyEvent')
Expand Down

0 comments on commit 1c4c953

Please sign in to comment.