File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
03 Writing Algorithms/22 Trading and Orders/10 Order Errors Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 280280<p>To avoid this order response error, check if there are enough shares available before you place an order to short a security.</p>
281281
282282<a id='invalid-new-order-status'></a><div class="section-example-container">
283- <pre class="csharp">var availableToBorrow = ShortableQuantity(_symbol);
284- if (availableToBorrow == null || quantityToBorrow <= availableToBorrow )
283+ <pre class="csharp">
284+ if (quantityToBorrow <= ShortableQuantity(_symbol) )
285285{
286286 MarketOrder(_symbol, -quantityToBorrow);
287287}</pre>
288- <pre class="python">available_to_borrow = self.shortable_quantity(self._symbol)
289- if available_to_borrow == None or quantity_to_borrow <= available_to_borrow :
288+ <pre class="python">
289+ if quantity_to_borrow <= self.shortable_quantity(self._symbol) :
290290 self.market_order(self._symbol, -quantity_to_borrow)</pre>
291291</div>
292292
You can’t perform that action at this time.
0 commit comments