krishnavelu / alice_blue

Official Python library for Alice Blue API trading
GNU General Public License v3.0
134 stars 82 forks source link

How can we pass tag while placing order? #86

Closed rishiajmera closed 4 years ago

rishiajmera commented 4 years ago

I don't see any option to pass tag in place_order method. How can we pass order tag?

krishnavelu commented 4 years ago

Why do you need a tag? If you place order you get order_id in return.

rishiajmera commented 4 years ago

I'm placing multiple orders at the same time in threads. So sometimes, it gets difficult to figure out which order is which. Tag helps for that. Anyhow, I have done the change in the library but please provide an option to pass order ID in next update.

krishnavelu commented 4 years ago

You get order_id in return while you place order. You cannot pass order_id while placing order. Even if you place multiple orders in thread for each and every place_order you’ll get an order_id in return.

rishiajmera commented 4 years ago

What if due to network error, I didn't receive order ID but the order is actually placed? This has happened with Zerodha API. so passing a tag is important. If I don't receive order ID, I will first check with order book if any order present with the tag I had passed. If yes, the order was successful otherwise it will retry placing order.

krishnavelu commented 4 years ago

Does zerodha provides order tags? Give me example.

rishiajmera commented 4 years ago

Aliceblue already has that functionality of tag. Its just that order placement function doesn't have any argument for it. "order_1" is passed every time. In Zerodha API, they are just allowing the users to pass their own unique order ID. You can do that too. This is just a suggestion for improvement. Hope you're not taking it wrong.

krishnavelu commented 4 years ago

@rishiajmera Added order_tag default argument in place_order() function

rishiajmera commented 4 years ago

Thanks, Krishna for adding it. Cheers!