Skip to content

Commit

Permalink
Merge pull request #40 from rcholic/fix_bid
Browse files Browse the repository at this point in the history
update field name for bid ask last
  • Loading branch information
rcholic authored Sep 4, 2024
2 parents 59d2e16 + 5c3c264 commit 5a698d5
Show file tree
Hide file tree
Showing 6 changed files with 5,028 additions and 19 deletions.
1 change: 1 addition & 0 deletions cschwabpy/SchwabAsyncClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ async def download_option_chain_async(
)
if response.status_code == 200:
json_res = response.json()
print("json_res", json.dumps(json_res, indent=4))
return OptionChain(**json_res)
else:
raise Exception(
Expand Down
25 changes: 12 additions & 13 deletions cschwabpy/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,10 @@ class OptionContract(JSONSerializableBaseModel):
symbol: str
description: str
exchangeName: str
bidPrice: Optional[float] = None
askPrice: Optional[float] = None
lastPrice: Optional[float] = None
markPrice: Optional[float] = None
bid: Optional[float] = None
ask: Optional[float] = None
last: Optional[float] = None
mark: Optional[float] = None
bidSize: Optional[int] = None
askSize: Optional[int] = None
lastSize: Optional[int] = None
Expand All @@ -277,9 +277,8 @@ class OptionContract(JSONSerializableBaseModel):
openPrice: Optional[float] = None
closePrice: Optional[float] = None
totalVolume: Optional[int] = None
tradeDate: Optional[int] = None
quoteTimeInLong: Optional[int]
tradeTimeInLong: Optional[int] = None
quoteTimeInLong: Optional[int]
netChange: Optional[float] = None
volatility: Optional[float] = None
delta: Optional[float] = None
Expand All @@ -292,7 +291,7 @@ class OptionContract(JSONSerializableBaseModel):
theoreticalOptionValue: Optional[float] = None
theoreticalVolatility: Optional[float] = None
strikePrice: float
expirationDate: str
expirationDate: str # TODO: change to datetime
daysToExpiration: int
expirationType: str # M for end of month, W for week, Q for quarter, S for third friday
lastTradingDay: Optional[int] = None
Expand All @@ -312,10 +311,10 @@ def to_dataframe_row(self, strip_space: bool = False) -> List[Any]:
result: List[Any] = [
self.strikePrice,
symbol,
self.lastPrice,
self.last,
self.openInterest,
self.askPrice,
self.bidPrice,
self.ask,
self.bid,
self.expirationDate,
util.ts_to_date_string(self.quoteTimeInLong),
self.totalVolume,
Expand All @@ -337,14 +336,14 @@ class Underlying(JSONSerializableBaseModel):
description: Optional[str] = None
exchangeName: str
highPrice: Optional[float] = None
lastPrice: Optional[float] = None
last: Optional[float] = None
lowPrice: Optional[float] = None
mark: Optional[float] = None
markChange: Optional[float] = None
markPercentChange: Optional[float] = None
openPrice: Optional[float] = None
percentChange: float
quoteTime: int
percentChange: Optional[float] = None
quoteTime: Optional[int] = None
symbol: str
totalVolume: Optional[int] = None
tradeTime: Optional[int] = None
Expand Down
8 changes: 4 additions & 4 deletions cschwabpy/models/trade_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ class AccountOption(AccountInstrument):


class OrderLeg(JSONSerializableBaseModel):
askPrice: Optional[float] = None
bidPrice: Optional[float] = None
lastPrice: Optional[float] = None
marketPrice: Optional[float] = None
ask: Optional[float] = None
bid: Optional[float] = None
last: Optional[float] = None
market: Optional[float] = None
projectedCommission: Optional[float] = None
quantity: Optional[float] = None
finalSymbol: Optional[str] = None
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cschwabpy"
version = "0.1.3.9"
version = "0.1.4.0"
description = ""
authors = ["Tony Wang <[email protected]>"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="CSchwabPy",
version="0.1.3.9",
version="0.1.4.0",
description="Charles Schwab Stock & Option Trade API Client for Python.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
Loading

0 comments on commit 5a698d5

Please sign in to comment.