quickclient 0.1.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new66

quickclient

A new Flutter package QuickClient .

https://github.com/dileep4g/quickclient

dependencies:
  flutter:
    sdk: flutter
    quickclient:

Flutter 0.5.1 • channel beta • https://github.com/flutter/flutter.git Framework • revision c7ea3ca377 (5 months ago) • 2018-05-29 21:07:33 +0200 Engine • revision 1ed25ca7b7 Tools • Dart 2.0.0-dev.58.0.flutter-f981f09760

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

[0.0.1] - Release.

  • A Customisable QuickClient Library written in dart .

example/example.dart

import 'package:quickclient/common/common.dart';
import 'package:quickclient/data/drpPacket.dart';
import 'package:quickclient/data/packet.dart';
import 'package:quickclient/data/spotPacket.dart';
import 'package:quickclient/services/configuration.dart';
import 'package:quickclient/services/eventDetails.dart';
import 'package:quickclient/services/handler.dart';
import 'package:quickclient/services/keyManager.dart';
import 'package:quickclient/services/marketData.dart';
import 'package:quickclient/services/quickEvent.dart';
import 'package:quickclient/data/broadcastPacket.dart';
import 'package:quickclient/data/commodityPacket.dart';
import 'package:quickclient/data/derivativePacket.dart';
import 'package:quickclient/data/indexPacket.dart';
import 'package:quickclient/data/marketDepthPacket.dart';
import 'package:quickclient/data/openInterestPacket.dart';
import 'package:quickclient/data/quotePacket.dart';
import 'package:quickclient/data/quotePacket22.dart';
import 'package:quickclient/data/quotePacket23.dart';
import 'package:quickclient/data/quotePacket27.dart';
import 'package:quickclient/data/quotePacket32.dart';
import 'package:quickclient/data/quotePacket33.dart';
import 'package:quickclient/data/quotePacket34.dart';
import 'package:quickclient/data/quotePacket35.dart';
import 'package:quickclient/data/quotePacket37.dart';
import 'package:quickclient/data/quotePacket38.dart';
import 'package:quickclient/data/quotePacket39.dart';
import 'package:quickclient/data/quotePacket41.dart';
import 'package:quickclient/data/quotePacket42.dart';
import 'package:quickclient/data/reportsPacket.dart';
import 'package:quickclient/data/spreadPacket.dart';
import 'package:quickclient/data/unsolicitedPacket.dart';
class StartQuickClient implements QuickEvent {
  Handler handler;
  StartQuickClient()
  {
    try
    {
      handler = MarketData.getInstance();
      handler.setEventHandler(this);
      handler.setAddress(Common.serverAddress);
      handler.setPort(Common.port);
      handler.setUserCredentials(Common.userName, Common.password);
      if (handler.connect())
      {
        print('Connect initiated');
        onConnect();
      }
      else
      {
        print("Connect failed ");
      }
    }
    catch (e)
    {
      print("Error in StartQuickClient: $e" );
    }
  }

  @override
  void onError(EventDetails details) {
    print("StartQuickClient.OnError(:::OnError:::)");
    print("StartQuickClient.onError(:::code:::)"+ details.getCode().toString());
  }

  @override
  void onDisconnect(EventDetails details) {
    print("StartQuickClient.OnDisconnect(:::Disconnect succeeded:::)");
    print("StartQuickClient.onDisconnect(:::code:::)"+ details.getCode().toString());
  }


  @override
  void onConnect() {
    print("StartQuickClient.OnConnect(:::Connect succeeded:::)");
    handler.addScrip(Common.exchange, Common.scriptCode);
    // handler.addMarketDepth(Common.exchange, Common.scriptCode);
    //handler.addOptionChain(Common.exchange, Common.scriptCode);
    //handler.addFutureChain(Common.exchange, Common.scriptCode);
    // handler.addDerivativeChain(Common.exchange, Common.scriptCode);
    //handler.addSpotScrip(Common.exchange, Common.scriptCode);
  }

  static void onPacketArrived(Packet packet){
    if (packet.exchange == Configuration.MCX || packet.exchange == Configuration.NSECUR)
    {
      if (packet is MarketDepthPacket || packet is IndexPacket || packet is BroadcastPacket || packet is DPRPacket || packet is SpreadPacket || packet is DerivativePacket || packet is OpenInterestPacket || packet is QuotePacket42)
      {
        onPacketArrivedDisplay(packet);
      }
      else
      {
        bool isSpotAvailable = Configuration.spotChain;//checkForSpot(packet.exchange, packet.getScripCode());
        if (isSpotAvailable)
        {
          SpotPacket spotPacket = new SpotPacket();
          spotPacket.exchange = packet.exchange;
          spotPacket.scripCode = packet.getScripCode();
          if(packet is CommodityPacket)
          {
            CommodityPacket p = (packet);
            spotPacket.lastTradedPrice = p.getLastTradedPrice();
            spotPacket.closePrice = p.getClosePrice();
          }
          else if(packet is CommodityPacket28)
          {
            CommodityPacket28 p = (packet);
            spotPacket.lastTradedPrice = p.getLastTradedPrice();
            spotPacket.closePrice = p.getClosePrice();
          }
          else if (packet is QuotePacket37)
          {
            QuotePacket37 p = (packet);
            spotPacket.lastTradedPrice = p.getLastTradedPrice();
            spotPacket.closePrice = p.getClosePrice();
          }
          else if (packet is QuotePacket38)
          {
            QuotePacket38 p = (packet);
            spotPacket.lastTradedPrice = p.getLastTradedPrice();
            spotPacket.closePrice = p.getClosePrice();
          }
          else if (packet is QuotePacket39)
          {
            QuotePacket39 p = (packet);
            spotPacket.lastTradedPrice = p.getLastTradedPrice();
            spotPacket.closePrice = p.getClosePrice();
          }
          else if (packet is QuotePacket27)
          {
            QuotePacket27 p = (packet);
            spotPacket.lastTradedPrice = p.getLastTradedPrice();
            spotPacket.closePrice = p.getClosePrice();
          }
          onPacketArrivedDisplay(spotPacket);
        }
        else
        {
          onPacketArrivedDisplay(packet);
        }
      }
    }
    else{
      onPacketArrivedDisplay(packet);
    }


  }

  static void onPacketArrivedDisplay(Packet packet){
    if (packet is IndexPacket) {
      IndexPacket p = (packet);
      print("StartQuickClient.onPacketArrived(:::IndexPacket Arrived:::)");
      print(p.toString());
    } else if (packet is DerivativePacket) {
      DerivativePacket p=(packet);
      print("StartQuickClient.onPacketArrived(:::DerivativePacket Arrived:::)");
      print(p.toString());

    } else if (packet is QuotePacket) {
      QuotePacket p=(packet);
      print("StartQuickClient.onPacketArrived(:::QuotePacket Arrived:::)");
      print(p.toString());
    } else if(packet is MarketDepthPacket){
      MarketDepthPacket p = (packet) ;//var p = packet as MarketDepthPacket;
      print("StartQuickClient.onPacketArrived(:::MarketDepthPacket Arrived:::)");
      print("Scripcode: " + packet.getScripCode());
      print("BuyOrders: " + p.getBuyOrders()[0].toString() + " SellOrders: " + p.getSellOrders()[0].toString());
      print("BuyOrders: " + p.getBuyOrders()[1].toString() + " SellOrders: " + p.getSellOrders()[1].toString());
      print("BuyOrders: " + p.getBuyOrders()[2].toString() + " SellOrders: " + p.getSellOrders()[2].toString());
      print("BuyOrders: " + p.getBuyOrders()[3].toString() + " SellOrders: " + p.getSellOrders()[3].toString());
      print("BuyOrders: " + p.getBuyOrders()[4].toString() + " SellOrders: " + p.getSellOrders()[4].toString());

      print("BuyPrice: " + p.getBuyPrice()[0].toString() + " SellPrice: " + p.getSellPrice()[0].toString());
      print("BuyPrice: " + p.getBuyPrice()[1].toString() + " SellPrice: " + p.getSellPrice()[1].toString());
      print("BuyPrice: " + p.getBuyPrice()[2].toString() + " SellPrice: " + p.getSellPrice()[2].toString());
      print("BuyPrice: " + p.getBuyPrice()[3].toString() + " SellPrice: " + p.getSellPrice()[3].toString());
      print("BuyPrice: " + p.getBuyPrice()[4].toString() + " SellPrice: " + p.getSellPrice()[4].toString());

      print("BuyQty: " + p.getBuyQty()[0].toString() + " SellQty: " + p.getSellQty()[0].toString());
      print("BuyQty: " + p.getBuyQty()[1].toString() + " SellQty: " + p.getSellQty()[1].toString());
      print("BuyQty: " + p.getBuyQty()[2].toString() + " SellQty: " + p.getSellQty()[2].toString());
      print("BuyQty: " + p.getBuyQty()[3].toString() + " SellQty: " + p.getSellQty()[3].toString());
      print("BuyQty: " + p.getBuyQty()[4].toString() + " SellQty: " + p.getSellQty()[4].toString());
      print("Timestamp: " + p.getTimestamp().toString());

    } else if (packet is UnsolicitedPacket) {
      UnsolicitedPacket p= (packet);
      print("StartQuickClient.onPacketArrived(:::UnsolicitedPacket Arrived:::)");
      print(p.toString());
    }else if (packet is QuotePacket41){
      QuotePacket41 p = (packet) ;
      print("StartQuickClient.onPacketArrived(:::QuotePacket41 Arrived:::)");
      print(p.toString());
    }
    else if (packet is QuotePacket22) {
      QuotePacket22 p=(packet);
      print("StartQuickClient.onPacketArrived(:::QuotePacket22 Arrived:::)");
      print(p.toString());
    }
    else if (packet is QuotePacket23) {
      QuotePacket23 p=(packet);
      print("StartQuickClient.onPacketArrived(:::QuotePacket23 Arrived:::)");
      print(p.toString());
    }
    else if (packet is QuotePacket27) {
      QuotePacket27 p=(packet);
      print("StartQuickClient.onPacketArrived(:::QuotePacket27 Arrived:::)");
      print(p.toString());
    }
    else if (packet is QuotePacket35) {
      QuotePacket35 p=(packet);
      print("StartQuickClient.onPacketArrived(:::QuotePacket35 Arrived:::)");
      print(p.toString());
    }
    else if (packet is QuotePacket39) {
      QuotePacket39 p=(packet);
      print("StartQuickClient.onPacketArrived(:::QuotePacket39 Arrived:::)");
      print(p.toString());
    }
    else if (packet is QuotePacket34) {
      QuotePacket34 p=(packet);
      print("StartQuickClient.onPacketArrived(:::QuotePacket34 Arrived:::)");
      print(p.toString());
    }
    else if (packet is QuotePacket38) {
      QuotePacket38 p = (packet);
      print("StartQuickClient.onPacketArrived(:::QuotePacket38 Arrived:::)");
      print(p.toString());
    }
    else if (packet is QuotePacket33) {
      QuotePacket33 p=(packet);
      print("StartQuickClient.onPacketArrived(:::QuotePacket33 Arrived:::)");
      print(p.toString());
    }
    else if (packet is QuotePacket37) {
      QuotePacket37 p=(packet);
      print("StartQuickClient.onPacketArrived(:::QuotePacket37 Arrived:::)");
      print(p.toString());
    }
    else if (packet is CommodityPacket28) {
      CommodityPacket28 p=(packet);
      print("StartQuickClient.onPacketArrived(:::CommodityPacket28 Arrived:::)");
      print(p.toString());
    }
    else if (packet is QuotePacket32) {
      QuotePacket32 p=(packet);
      print("StartQuickClient.onPacketArrived(:::QuotePacket32 Arrived:::)");
      print(p.toString());
    }
    else if (packet is QuotePacket42) {
      QuotePacket42 p=(packet);
      print("StartQuickClient.onPacketArrived(:::QuotePacket42 Arrived:::)");
      print(p.toString());
    }
    else if (packet is CommodityPacket29) {
      CommodityPacket29 p=(packet);
      print("StartQuickClient.onPacketArrived(:::CommodityPacket29 Arrived:::)");
      print(p.toString());
    }
    else if (packet is SpreadPacket) {
      SpreadPacket p=(packet);
      print("StartQuickClient.onPacketArrived(:::SpreadPacket Arrived:::)");
      print(p.toString());
    }
    else if (packet is ReportsPacket) {
      ReportsPacket p=(packet);
      print("StartQuickClient.onPacketArrived(:::ReportsPacket Arrived:::)");
      print(p.toString());
    }

    else if (packet is OpenInterestPacket) {
      OpenInterestPacket p=(packet);
      print("StartQuickClient.onPacketArrived(:::Open Interest Packet Arrived:::)");
      print(p.toString());
    }
    else if(packet is BroadcastPacket){
      BroadcastPacket p=(packet);
      print("StartQuickClient.onPacketArrived(:::Open Broadcast Packet Arrived:::)");
      print(p.toString());
    }else if (packet is DPRPacket) {
      DPRPacket p=(packet);
      print("StartQuickClient.onPacketArrived(:::DPRPacket Arrived:::)");
      print(p.toString());
    }
    else if (packet is SpotPacket) {
      SpotPacket p=(packet);
      print("StartQuickClient.onPacketArrived(:::SpotPacket Arrived:::)");
      print(p.toString());
    }
  }

  static bool checkForSpot(int exchange, String scripCode) {
    return KeyManager.isSpotAvailable(exchange, scripCode);
  }

  void main() {
    StartQuickClient startQuickClient = new StartQuickClient();
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  quickclient: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:quickclient/common/buffer_reader.dart';
import 'package:quickclient/common/common.dart';
import 'package:quickclient/common/readBuffer.dart';
import 'package:quickclient/common/startQuickClient.dart';
import 'package:quickclient/data/broadcastPacket.dart';
import 'package:quickclient/data/commodityPacket.dart';
import 'package:quickclient/data/derivativePacket.dart';
import 'package:quickclient/data/drpPacket.dart';
import 'package:quickclient/data/indexPacket.dart';
import 'package:quickclient/data/marketDepthPacket.dart';
import 'package:quickclient/data/openInterestPacket.dart';
import 'package:quickclient/data/packet.dart';
import 'package:quickclient/data/quotePacket.dart';
import 'package:quickclient/data/quotePacket13.dart';
import 'package:quickclient/data/quotePacket2.dart';
import 'package:quickclient/data/quotePacket22.dart';
import 'package:quickclient/data/quotePacket23.dart';
import 'package:quickclient/data/quotePacket27.dart';
import 'package:quickclient/data/quotePacket32.dart';
import 'package:quickclient/data/quotePacket33.dart';
import 'package:quickclient/data/quotePacket34.dart';
import 'package:quickclient/data/quotePacket35.dart';
import 'package:quickclient/data/quotePacket37.dart';
import 'package:quickclient/data/quotePacket38.dart';
import 'package:quickclient/data/quotePacket39.dart';
import 'package:quickclient/data/quotePacket41.dart';
import 'package:quickclient/data/quotePacket42.dart';
import 'package:quickclient/data/records.dart';
import 'package:quickclient/data/reportsPacket.dart';
import 'package:quickclient/data/spotPacket.dart';
import 'package:quickclient/data/spreadPacket.dart';
import 'package:quickclient/data/unsolicitedPacket.dart';
import 'package:quickclient/services/configuration.dart';
import 'package:quickclient/services/eventDetails.dart';
import 'package:quickclient/services/handler.dart';
import 'package:quickclient/services/keyManager.dart';
import 'package:quickclient/services/marketData.dart';
import 'package:quickclient/services/mdHandler.dart';
import 'package:quickclient/services/packetBuilder.dart';
import 'package:quickclient/services/quickEvent.dart';
import 'package:quickclient/sockets/tcpConnection.dart';
  
Version Uploaded Documentation Archive
0.1.0 Nov 2, 2018 Go to the documentation of quickclient 0.1.0 Download quickclient 0.1.0 archive
0.0.2 Oct 30, 2018 Go to the documentation of quickclient 0.0.2 Download quickclient 0.0.2 archive
0.0.1 Oct 30, 2018 Go to the documentation of quickclient 0.0.1 Download quickclient 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
35
Health:
Code health derived from static analysis. [more]
96
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
66
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6
  • Flutter: 0.11.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/sockets/tcpConnection.dart. (-1.49 points)

Analysis of lib/sockets/tcpConnection.dart reported 3 hints:

line 70 col 22: The value of the local variable 'futureSocket' isn't used.

line 288 col 11: The value of the local variable 'filler' isn't used.

line 290 col 17: The value of the local variable 'buf' isn't used.

Fix lib/common/startQuickClient.dart. (-1 points)

Analysis of lib/common/startQuickClient.dart reported 2 hints:

line 1 col 8: Unused import: 'dart:math'.

line 301 col 22: The value of the local variable 'startQuickClient' isn't used.

Fix lib/data/reportsPacket.dart. (-0.50 points)

Analysis of lib/data/reportsPacket.dart reported 1 hint:

line 3 col 8: Unused import: 'package:quickclient/data/records.dart'.

Fix lib/services/marketData.dart. (-0.50 points)

Analysis of lib/services/marketData.dart reported 1 hint:

line 8 col 8: Unused import: 'package:quickclient/services/packetBuilder.dart'.

Fix lib/services/packetBuilder.dart. (-0.50 points)

Analysis of lib/services/packetBuilder.dart reported 1 hint:

line 44 col 11: The value of the local variable 'service' isn't used.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test