ScripMasterDataRequest::ScripMasterDataRequest(const char * buf)
{
  int offset = 0;
  UNSIGNED_INTEGER tmpInt1 = 0, tmpInt2 = 0;
  UNSIGNED_CHARACTER tmpChar = 0;
  UNSIGNED_LONG tmpLong1 = 0, tmpLong2 = 0;
  UNSIGNED_SHORT tmpShort1 = 0, tmpShort2 = 0;
  
  DESERIALIZE_8(tmpChar, setScripMasterDataRequestType(tmpChar), buf, offset);
  DESERIALIZE_32(tmpInt1, tmpInt2, setClientId(tmpInt2), buf, offset);
  DESERIALIZE_64(tmpLong1, tmpLong2, setRecordNumber(tmpLong2), buf, offset);
  DESERIALIZE_64(tmpLong1, tmpLong2, setSecurityId(tmpLong2), buf, offset);
  DESERIALIZE_64(tmpLong1, tmpLong2, setSymbolId(tmpLong2), buf, offset);
  DESERIALIZE_16(tmpShort1, tmpShort2, setExchangeId(tmpShort2), buf, offset);

  setSymbol(strdup(buf + offset));
  offset += SYMBOL_SIZE;
  setSeries(strdup(buf + offset));
  offset += SERIES_SIZE;
  setMarketName(strdup(buf + offset));
  offset += MARKET_NAME_SIZE;
  DESERIALIZE_8(tmpChar, setOptionType(tmpChar), buf, offset);
  DESERIALIZE_8(tmpChar, setOptionMode(tmpChar), buf, offset);
  DESERIALIZE_8(tmpChar, setSecurityType(tmpChar), buf, offset);
  DESERIALIZE_64(tmpLong1, tmpLong2, setStrikePrice(tmpLong2), buf, offset);
  DESERIALIZE_32(tmpInt1, tmpInt2, setExpiryYearMon(tmpInt2), buf, offset);
  DESERIALIZE_32(tmpInt1, tmpInt2, setExpiryDate(tmpInt2), buf, offset);
  DESERIALIZE_32(tmpInt1, tmpInt2, setNumberOfRecords(tmpInt2), buf, offset);
  setSymbolAlias(strdup(buf + offset));
  offset += SYMBOL_ALIAS_SIZE;

}
Exemple #2
0
chart_display::chart_display(chart_dd const& dd)
{
	auto _layout = new Wt::WVBoxLayout;
	setLayout(_layout);

	m_model = new Wt::WStandardItemModel();

	auto chart = new Wt::Chart::WCartesianChart{};

	chart->setBackground(Wt::WColor(220, 220, 220));
	chart->setModel(m_model);
	chart->setXSeriesColumn(0);
	chart->setLegendEnabled(true);
	chart->setType(Wt::Chart::ScatterPlot);

	/*
	* Provide ample space for the title, the X and Y axis and the legend.
	*/
	chart->setPlotAreaPadding(40, Wt::Left | Wt::Top | Wt::Bottom);
	chart->setPlotAreaPadding(120, Wt::Right);

	chart->axis(Wt::Chart::Axis::XAxis).setTitle(dd.x_axis_name);

	chart->resize(500, 400);
	chart->setMargin(Wt::WLength::Auto, Wt::Left | Wt::Right);

	_layout->addWidget(chart);

	
	auto num_series = dd.series.size();
	m_model->insertColumns(0, num_series + 1);
	std::vector< Wt::Chart::WDataSeries > chart_series;
	for(size_t i = 0; i < num_series; ++i)
	{
		m_model->setHeaderData(i + 1, dd.series[i].name);
		chart_series.push_back(Wt::Chart::WDataSeries(i + 1, 
			Wt::Chart::LineSeries));
			// TODO: configurable: Wt::Chart::PointSeries));
	}

	chart->setSeries(chart_series);
}