@@ -55,6 +55,10 @@ class Stock(apininjas.abc.FinancialInstrument):
5555
5656 .. container:: operations
5757
58+ .. describe:: str(x)
59+
60+ Returns the stock's name.
61+
5862 .. describe:: x == y
5963
6064 Checks if two stocks are equal.
@@ -114,6 +118,9 @@ def __repr__(self) -> str:
114118 joined = " " .join ([f"{ a } ={ v !r} " for a , v in attrs ])
115119 return f"<Stock { joined } >"
116120
121+ def __str__ (self ) -> str :
122+ return self .name
123+
117124 def __eq__ (self , other : Stock ) -> bool :
118125 return self .ticker == other .ticker
119126
@@ -137,6 +144,10 @@ class Commodity(apininjas.abc.FinancialInstrument):
137144
138145 .. container:: operations
139146
147+ .. describe:: str(x)
148+
149+ Returns the name of the commodity future.
150+
140151 .. describe:: x == y
141152
142153 Checks if two commodity futures are equal.
@@ -199,6 +210,9 @@ def __repr__(self) -> str:
199210 joined = " " .join ([f"{ a } ={ v !r} " for a , v in attrs ])
200211 return f"<Commodity { joined } >"
201212
213+ def __str__ (self ) -> str :
214+ return self .name
215+
202216 def __eq__ (self , other : Commodity ) -> bool :
203217 return self .type == other .type
204218
@@ -222,6 +236,10 @@ class Crypto(apininjas.abc.FinancialInstrument):
222236
223237 .. container:: operations
224238
239+ .. describe:: str(x)
240+
241+ Returns the cryptocurrency's symbol.
242+
225243 .. describe:: x == y
226244
227245 Checks if two cryptocurrencies are equal.
@@ -264,6 +282,9 @@ def __init__(self, *, http: HTTPClient, data: CryptoPayload):
264282 def __repr__ (self ) -> str :
265283 return f"<Crypto symbol={ self .symbol } >"
266284
285+ def __str__ (self ) -> str :
286+ return self .symbol
287+
267288 def __eq__ (self , other : Crypto ) -> bool :
268289 return self .symbol == other .symbol
269290
@@ -287,6 +308,10 @@ class Currency:
287308
288309 .. container:: operations
289310
311+ .. describe:: str(x)
312+
313+ Returns the currency's name.
314+
290315 .. describe:: x == y
291316
292317 Checks if two currencies are equal.
@@ -321,6 +346,9 @@ def __repr__(self) -> str:
321346 joined = " " .join ([f"{ a } ={ v !r} " for a , v in attrs ])
322347 return f"<Currency { joined } >"
323348
349+ def __str__ (self ) -> str :
350+ return self .name
351+
324352 def __eq__ (self , other : Currency ) -> bool :
325353 return self .name == other .name and self .reference == other .reference
326354
0 commit comments