@@ -12,14 +12,14 @@ Kite Connect is a set of REST-like APIs that expose many capabilities required t
1212## Usage
1313- [ Download Kite Connect 3 jar file] ( https://github.com/zerodhatech/javakiteconnect/tree/kite3/dist ) and include it in your build path.
1414
15- - Include com.rainmatter .kiteconnect into build path from maven. Use version 3.0.0
15+ - Include com.zerodhatech .kiteconnect into build path from maven. Use version 3.0.0
1616
1717- To use javakiteconnect in ** Android** , you need to include jar file in the libs directory and add the following line in you module's gradle file ``` compile files('libs/kiteconnect.jar') ```
1818
1919## API usage
2020``` java
2121// Initialize Kiteconnect using apiKey.
22- Kiteconnect kiteSdk = new Kiteconnect (" your_apiKey" );
22+ KiteConnect kiteSdk = new KiteConnect (" your_apiKey" );
2323
2424// Set userId.
2525kiteSdk. setUserId(" your_userId" );
@@ -29,7 +29,7 @@ Get login url. Use this url in webview to login user, after authenticating user
2929String url = kiteSdk. getLoginUrl();
3030
3131// Get accessToken as follows,
32- UserModel userModel = kiteSdk. requestAccessToken(" request_token" , " your_apiSecret" );
32+ User user = kiteSdk. requestAccessToken(" request_token" , " your_apiSecret" );
3333
3434// Set request token and public token which are obtained from login process.
3535kiteSdk. setAccessToken(userModel. accessToken);
@@ -48,29 +48,30 @@ Margin margins = kiteSdk.getMargins("equity");
4848System . out. println(margins. available. cash);
4949System . out. println(margins. utilised. debits);
5050
51- /* Place order method requires a map argument which contains,
52- tradingsymbol, exchange, transaction_type, order_type, quantity, product, price, trigger_price, disclosed_quantity, validity
53- squareoff_value, stoploss_value, trailing_stoploss
54- and variety which can be value can be regular, bo, co, amo.
55- place order which will return order model which will have only orderId in the order model.
56-
57- Following is an example param for SL order,
58- if a call fails then KiteException will have error message in it
59- Success of this call implies only order has been placed successfully, not order execution.*/
60- Map<String , Object > param = new HashMap<String , Object > (){
61- {
62- put(" quantity" , " 1" );
63- put(" order_type" , " SL" );
64- put(" tradingsymbol" , " HINDALCO" );
65- put(" product" , " CNC" );
66- put(" exchange" , " NSE" );
67- put(" transaction_type" , " BUY" );
68- put(" validity" , " DAY" );
69- put(" price" , " 158.0" );
70- put(" trigger_price" , " 157.5" );
71- }};
72- Order order = kiteconnect. placeOrder(param, " regular" );
73- System . out. println(order. orderId);
51+ /* * Place order method requires a orderParams argument which contains,
52+ * tradingsymbol, exchange, transaction_type, order_type, quantity, product, price, trigger_price, disclosed_quantity, validity
53+ * squareoff_value, stoploss_value, trailing_stoploss
54+ * and variety (value can be regular, bo, co, amo)
55+ * place order will return order model which will have only orderId in the order model
56+ *
57+ * Following is an example param for LIMIT order,
58+ * if a call fails then KiteException will have error message in it
59+ * Success of this call implies only order has been placed successfully, not order execution. */
60+
61+ OrderParams orderParams = new OrderParams ();
62+ orderParams. quantity = 1 ;
63+ orderParams. orderType = Constants . ORDER_TYPE_LIMIT ;
64+ orderParams. tradingsymbol = " ASHOKLEY" ;
65+ orderParams. product = Constants . PRODUCT_CNC ;
66+ orderParams. exchange = Constants . EXCHANGE_NSE ;
67+ orderParams. transactionType = Constants . TRANSACTION_TYPE_BUY ;
68+ orderParams. validity = Constants . VALIDITY_DAY ;
69+ orderParams. price = 122.2 ;
70+ orderParams. triggerPrice = 0.0 ;
71+ orderParams. tag = " myTag" ; // tag is optional and it cannot be more than 8 characters and only alphanumeric is allowed
72+
73+ Order order = kiteConnect. placeOrder(orderParams, Constants . VARIETY_REGULAR );
74+ System . out. println(order. orderId);
7475```
7576For more details, take a look at Examples.java in sample directory.
7677
@@ -128,7 +129,7 @@ For more details, take a look at Examples.java in sample directory.
128129
129130 tickerProvider. setTryReconnection(true );
130131 // maximum retries and should be greater than 0
131- tickerProvider. setMaximumRetries(50 );
132+ tickerProvider. setMaximumRetries(10 );
132133 // set maximum retry interval in seconds
133134 tickerProvider. setMaximumRetryInterval(30 );
134135
@@ -286,7 +287,7 @@ For more details about different mode of quotes and subscribing for them, take a
286287
287288 Version 2:
288289 ``` java
289- Kiteconnect kiteSdk = new Kiteconnect (" your_apiKey" );
290+ KiteConnect kiteSdk = new KiteConnect (" your_apiKey" );
290291 ```
291292 Version 3:
292293 ``` java
0 commit comments