quickclient 0.1.0

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

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 pub get

Alternatively, your editor might support flutter pub 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]
54
Health:
Code health derived from static analysis. [more]
66
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
67
Learn more about scoring.

We analyzed this package on May 23, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.1
  • pana: 0.12.16
  • Flutter: 1.5.4-hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/services/configuration.dart. (-18.58 points)

Analysis of lib/services/configuration.dart reported 41 hints, including:

line 4 col 17: Name non-constant identifiers using lowerCamelCase.

line 5 col 10: Name non-constant identifiers using lowerCamelCase.

line 6 col 15: Name non-constant identifiers using lowerCamelCase.

line 6 col 28: Name non-constant identifiers using lowerCamelCase.

line 8 col 17: Name non-constant identifiers using lowerCamelCase.

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

Analysis of lib/services/packetBuilder.dart reported 15 hints, including:

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

line 441 col 18: Name non-constant identifiers using lowerCamelCase.

line 457 col 18: Name non-constant identifiers using lowerCamelCase.

line 489 col 18: Name non-constant identifiers using lowerCamelCase.

line 523 col 18: Name non-constant identifiers using lowerCamelCase.

Fix lib/services/eventDetails.dart. (-2.96 points)

Analysis of lib/services/eventDetails.dart reported 6 hints, including:

line 6 col 20: Name non-constant identifiers using lowerCamelCase.

line 7 col 7: Name non-constant identifiers using lowerCamelCase.

line 8 col 7: Name non-constant identifiers using lowerCamelCase.

line 9 col 7: Name non-constant identifiers using lowerCamelCase.

line 10 col 7: Name non-constant identifiers using lowerCamelCase.

Fix additional 38 files with analysis or formatting issues. (-9.95 points)

Additional issues in the following files:

  • lib/data/records.dart (5 hints)
  • lib/data/reportsPacket.dart (4 hints)
  • lib/sockets/tcpConnection.dart (4 hints)
  • lib/services/marketData.dart (3 hints)
  • lib/common/startQuickClient.dart (2 hints)
  • lib/services/keyManager.dart (2 hints)
  • lib/common/buffer_reader.dart (Run flutter format to format lib/common/buffer_reader.dart.)
  • lib/common/common.dart (Run flutter format to format lib/common/common.dart.)
  • lib/common/readBuffer.dart (Run flutter format to format lib/common/readBuffer.dart.)
  • lib/data/broadcastPacket.dart (Run flutter format to format lib/data/broadcastPacket.dart.)
  • lib/data/commodityPacket.dart (Run flutter format to format lib/data/commodityPacket.dart.)
  • lib/data/derivativePacket.dart (Run flutter format to format lib/data/derivativePacket.dart.)
  • lib/data/drpPacket.dart (Run flutter format to format lib/data/drpPacket.dart.)
  • lib/data/indexPacket.dart (Run flutter format to format lib/data/indexPacket.dart.)
  • lib/data/marketDepthPacket.dart (Run flutter format to format lib/data/marketDepthPacket.dart.)
  • lib/data/openInterestPacket.dart (Run flutter format to format lib/data/openInterestPacket.dart.)
  • lib/data/packet.dart (Run flutter format to format lib/data/packet.dart.)
  • lib/data/quotePacket.dart (Run flutter format to format lib/data/quotePacket.dart.)
  • lib/data/quotePacket13.dart (Run flutter format to format lib/data/quotePacket13.dart.)
  • lib/data/quotePacket2.dart (Run flutter format to format lib/data/quotePacket2.dart.)
  • lib/data/quotePacket22.dart (Run flutter format to format lib/data/quotePacket22.dart.)
  • lib/data/quotePacket23.dart (Run flutter format to format lib/data/quotePacket23.dart.)
  • lib/data/quotePacket27.dart (Run flutter format to format lib/data/quotePacket27.dart.)
  • lib/data/quotePacket32.dart (Run flutter format to format lib/data/quotePacket32.dart.)
  • lib/data/quotePacket33.dart (Run flutter format to format lib/data/quotePacket33.dart.)
  • lib/data/quotePacket34.dart (Run flutter format to format lib/data/quotePacket34.dart.)
  • lib/data/quotePacket35.dart (Run flutter format to format lib/data/quotePacket35.dart.)
  • lib/data/quotePacket37.dart (Run flutter format to format lib/data/quotePacket37.dart.)
  • lib/data/quotePacket38.dart (Run flutter format to format lib/data/quotePacket38.dart.)
  • lib/data/quotePacket39.dart (Run flutter format to format lib/data/quotePacket39.dart.)
  • lib/data/quotePacket41.dart (Run flutter format to format lib/data/quotePacket41.dart.)
  • lib/data/quotePacket42.dart (Run flutter format to format lib/data/quotePacket42.dart.)
  • lib/data/spotPacket.dart (Run flutter format to format lib/data/spotPacket.dart.)
  • lib/data/spreadPacket.dart (Run flutter format to format lib/data/spreadPacket.dart.)
  • lib/data/unsolicitedPacket.dart (Run flutter format to format lib/data/unsolicitedPacket.dart.)
  • lib/services/handler.dart (Run flutter format to format lib/services/handler.dart.)
  • lib/services/mdHandler.dart (Run flutter format to format lib/services/mdHandler.dart.)
  • lib/services/quickEvent.dart (Run flutter format to format lib/services/quickEvent.dart.)

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 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test