Tabnine Logo
PNLChangeEvent.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.activequant.domainmodel.streaming.PNLChangeEvent
constructor

Best Java code snippets using com.activequant.domainmodel.streaming.PNLChangeEvent.<init> (Showing top 2 results out of 315)

origin: activequant/aq2o

private PNLChangeEvent pnl(TimeStamp ts, String tid, double price, double posChange) {
  PNLChangeEvent pce = null; 
  Double formerPos = positions.get(tid);
     Double lastValuationPrice = lastValPrices.get(tid);
  Double avgPrice = avgPrices.get(tid);
  if (formerPos == null) {
    formerPos = 0.0;
    lastValuationPrice = 0.0;
  }
  Double newPos = formerPos + posChange;
  if (formerPos != 0.0) {
    // revalue the former position.
    double pnlChange = (price - lastValuationPrice) * formerPos;
    double unrealizedPnl = (price - avgPrice) * formerPos; 
    if(newPos==0.0)
      unrealizedPnl = 0.0; 
    pce = new PNLChangeEvent(ts, tid, pnlChange, unrealizedPnl);
    try {
      riskDataPublisher.send(pce);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  if(posChange!=0.0)
    positions.put(tid, newPos);
  lastValPrices.put(tid, price);
  return pce; 
}
origin: activequant/aq2o

public PNLChangeEvent ce(long l, String id, Double val){		
  PNLChangeEvent p = new PNLChangeEvent(new TimeStamp(l), id, val, 0.0);
  return p;
}

com.activequant.domainmodel.streamingPNLChangeEvent<init>

Popular methods of PNLChangeEvent

  • getChange
  • getTimeStamp
  • getTotalPnl
  • getTradInstId

Popular in Java

  • Finding current android device location
  • addToBackStack (FragmentTransaction)
  • putExtra (Intent)
  • setRequestProperty (URLConnection)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Collectors (java.util.stream)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now