Jump to content

The BSE/NSE Trading Thread


G_B_

Recommended Posts

4 hours ago, jusarrived said:

Cool .

you automating actual trades or just alerting and you do the trades manually ? 

can you share a sample code ? 

 

as of now i am planning to automate only the order execution part..  i can completely automate but which is not necessary for my requirements ..

if i want to do iron condor for 30 lots , i need to execute 18 to 24 orders in 5/10 mins ,  and 4 orders simultaneously..

now i have a very basic UI , where i can execute these orders by just clicking..

 

we can completely automate the trades , noone is stoping 

Link to comment
Share on other sites

4 hours ago, jusarrived said:

Cool .

you automating actual trades or just alerting and you do the trades manually ? 

can you share a sample code ? 

 

Logging into kite connect

          
        // Initialize kiteconnect
        kiteConnect = new KiteConnect( txtApiKey.getText() );

        // set userId
        kiteConnect.setUserId( txtUserID.getText() );
        
        // Get login url
        String loginURL = kiteConnect.getLoginUrl();

        FileInputStream fs;
        Properties in = new Properties();  

        try 
        {
            fs = new FileInputStream("cartmanToken.properties");
            in.load(fs);            
            fs.close();
            
            // Set the values
            accessToken =  in.getProperty("accessToken");
            publicToken =  in.getProperty("publicToken");
            
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
        
        // Set request token and public token which are obtained from login process.
        kiteConnect.setAccessToken(accessToken);
        kiteConnect.setPublicToken(publicToken);

 

Link to comment
Share on other sites

4 hours ago, jusarrived said:

Cool .

you automating actual trades or just alerting and you do the trades manually ? 

can you share a sample code ? 

 

 

...

 

getting margins

 

        Margins margins;
        try {
            margins = kiteConnect.getMargins("equity");
            System.out.println(margins.available.cash);
            System.out.println(margins.utilised.debits);
            System.out.println(margins.utilised.m2mUnrealised);
        } catch (JSONException | KiteException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
 

 

placing orders

 

    try {
           Map<String, Object> param = new HashMap<String, Object>(){
               {
                   put("quantity", "400");
                   put("order_type", "LIMIT");
                   put("tradingsymbol", "BANKNIFTY16NOV1725800CE");
                   put("product", "MIS");
                   put("exchange", "NFO");
                   put("transaction_type", "SELL");
                   put("validity", "DAY");
                   put("price", "100");
                   put("trigger_price", "0");
               }
           };
           Order order;
           order = kiteConnect.placeOrder(param, "regular");
           System.out.println(order.orderId);

    } catch (JSONException | KiteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

 

Link to comment
Share on other sites

On 13/11/2017 at 10:43 PM, velu said:

 

 

...

 

getting margins

 

        Margins margins;
        try {
            margins = kiteConnect.getMargins("equity");
            System.out.println(margins.available.cash);
            System.out.println(margins.utilised.debits);
            System.out.println(margins.utilised.m2mUnrealised);
        } catch (JSONException | KiteException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
 

 

placing orders

 

    try {
           Map<String, Object> param = new HashMap<String, Object>(){
               {
                   put("quantity", "400");
                   put("order_type", "LIMIT");
                   put("tradingsymbol", "BANKNIFTY16NOV1725800CE");
                   put("product", "MIS");
                   put("exchange", "NFO");
                   put("transaction_type", "SELL");
                   put("validity", "DAY");
                   put("price", "100");
                   put("trigger_price", "0");
               }
           };
           Order order;
           order = kiteConnect.placeOrder(param, "regular");
           System.out.println(order.orderId);

    } catch (JSONException | KiteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

 

Thanks , may use some of these ;) 

Link to comment
Share on other sites

43 minutes ago, velu said:

@jusarrived

 

extremely customized the order management system for my exact requirement ( only for index options , index futures and stock futures   .. firing market order is blocked for stock options  ) 

 

b070ef5916ffe9a4dbd507b78fc0e7e9af7ceef7

 

Very nice . you been using this already or still in test ? And does it help ? 

My agenda would be slightly different , not very straight forward . I want alerts as of now , indicators I specifically look for . placing orders is still manageable .

Link to comment
Share on other sites

Just now, jusarrived said:

Very nice . you been using this already or still in test ? And does it help ? 

My agenda would be slightly different , not very straight forward . I want alerts as of now , indicators I specifically look for . placing orders is still manageable .

 

my requirement is putting multiple orders in a very short time and i am using it for the last 3/4 sessions..

like iron condor mean buying  ATM call and put and selling OTM call and put together .. before there use to be a delay but now it works like a charm.. if i am creating 50 lots of iron condor  , i need to put 40 orders , now i can do it in a minute..

also now closing the postion is also easier .. before i always use to be worried about clossing my postions on time ..

 

you can link amibroker with kite apis .. like when you get a single in amibroker , you can use kite apis to place the orders..

i dont have thta requiremet , but few guys are doing it already i guess ( need to get sebi approval if it is compeletely automated  trading ) 

Link to comment
Share on other sites

@velu our banknifty expert :P

 

I have 9 lots each of 25550 PE - avg price 127  ( cmp 123)and 27000 CE - avg price 195 ( cmp 212)

 

I was using them to hedge with bnifty futures this week, which I have covered already . So what do you think ? At what point will time value decay start hurting me ? is holding close to expiry worth it ? 

Link to comment
Share on other sites

3 minutes ago, jusarrived said:

@velu our banknifty expert :P

 

I have 9 lots each of 25550 PE - avg price 127  ( cmp 123)and 27000 CE - avg price 195 ( cmp 212)

 

I was using them to hedge with bnifty futures this week, which I have covered already . So what do you think ? At what point will time value decay start hurting me ? is holding close to expiry worth it ? 

 

usually premium starts falling relayively higher one week before its expiry ( previous wednesday and thursday for next thursdays expiry )..

this applies for the monthly expiry as well considering only one week left for the current month expiry ..

 

if you want to hold sell further OTM call and put .. 

 

( anywya i am doing intraday only in BN )

Link to comment
Share on other sites

7 minutes ago, velu said:

 

usually premium starts falling relayively higher one week before its expiry ( previous wednesday and thursday for next thursdays expiry )..

this applies for the monthly expiry as well considering only one week left for the current month expiry ..

 

if you want to hold sell further OTM call and put .. 

 

( anywya i am doing intraday only in BN )

 

Ok  what if it gaps up/down ?   lets say realistically  +/- 80pts in first half hr. Should I short both sides at the same time ? 

 

one thing I hate is shorting options , scares the **** out off me . 

 

Link to comment
Share on other sites

4 minutes ago, jusarrived said:

 

Ok  what if it gaps up/down ?   lets say realistically  +/- 80pts in first half hr. Should I short both sides at the same time ? 

 

one thing I hate is shorting options , scares the **** out off me . 

 

 

we can hedge it , i hedge most of the times .. i try to inititae all the legs at more or less at the same time

it gives 200pt protection most of the times.. but if the premiums are already low then we cna buy at the money and sell outsude the money as well ( usually on wednesday )

 

when there is a gap down , premium will spike because of fear factor ie like atm option will be 300 ibstead of usual 270/275

but when there is a gap up , there wont be any relative increase in the premiums

 

still we cant blindly short .. this week i completely stoped trading , will start again once the mkt settles

 

Link to comment
Share on other sites

6 minutes ago, velu said:

 

we can hedge it , i hedge most of the times .. i try to inititae all the legs at more or less at the same time

it gives 200pt protection most of the times.. but if the premiums are already low then we cna buy at the money and sell outsude the money as well ( usually on wednesday )

 

when there is a gap down , premium will spike because of fear factor ie like atm option will be 300 ibstead of usual 270/275

but when there is a gap up , there wont be any relative increase in the premiums

 

still we cant blindly short .. this week i completely stoped trading , will start again once the mkt settles

 

Ok you mean not a intra day short , right ? How much does it cost to short intra day / lot in zerodha ? Am just not very confident , so not sure how much risk I can take with this .

 

I relatively have traded very less , bought some BN puts on friday . Should have made a lot more than I did , Zerodha portal froze on me for 15 mins I just couldnt exit . Anyway happy it wasnt a loss on such a day . 

A friend of mine had multiple short positions from Friday , he exited around when BN was down 600pts and went long again . Got ~1000 point swing . 

 

Iam waiting for some macros to go bad , like Crude spiking to 68-70 . Need a few days where I can blindly short . May sound a liitel anti national lol

Link to comment
Share on other sites

11 minutes ago, jusarrived said:

Ok you mean not a intra day short , right ? How much does it cost to short intra day / lot in zerodha ? Am just not very confident , so not sure how much risk I can take with this .

 

I relatively have traded very less , bought some BN puts on friday . Should have made a lot more than I did , Zerodha portal froze on me for 15 mins I just couldnt exit . Anyway happy it wasnt a loss on such a day . 

A friend of mine had multiple short positions from Friday , he exited around when BN was down 600pts and went long again . Got ~1000 point swing . 

 

Iam waiting for some macros to go bad , like Crude spiking to 68-70 . Need a few days where I can blindly short . May sound a liitel anti national lol

 

for 1 executed order , charges are 20rs .. lot size dont matter

 

by shorting i meant shorting both calls and puts .. short straddle or short strangle or iron condor for intraday..

we have todo extremely stupid thing or compeltely unlcuky to make big losses if we do it properly ..

 

like in the morning 257000 call + put was trading for 280rs and closed at 220rs .. if we have done properly we might not have lost anymoney even if the BN moved by 200 points ..

 

i see 50:40:10 rates .. success : neutral : losses 

 

Link to comment
Share on other sites

×
×
  • Create New...