Skip to content

Overview

andriypohorilko edited this page Apr 8, 2022 · 17 revisions

Finance SDK is built on top of the SciChart library and allows you to create a full-blown finance chart app with a few lines of code.

The central place of the Finance SDK is the SciFinanceChart. It holds studies, panes, data provider, chart modifiers, such as cursor, legend etc.

Create a Finance Chart

You can create a basic chart just in a few steps:

  1. Add a SciFinanceChart view to your .xml file:
<com.scitrader.finance.SciFinanceChart
    android:id="@+id/financeChart"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
  1. Create a dataProvider.
val candleDataProvider = DefaultCandleDataProvider()
chart.candleDataProvider = candleDataProvider

// fill the dataProvider with your candlestick data
fillDataProvider(candleDataProvider, DataManager.getCandles())
  1. Add some studies. As an example, let's add two studies - PriceSeriesStudy to show candlesticks and RSIStudy to show RSI(Relative Strength Index) indicator:
val priceSeriesStudy = PriceSeriesStudy(PaneId.DEFAULT_PANE)
val rsiStudy = RSIStudy(PaneId.uniqueId("RSI"))
        
chart.studies.add(priceSeriesStudy)
chart.studies.add(rsiStudy)

NOTE: Creating our priceSeriesStudy with a PaneId.DEFAULT_PANE pane id means that we want to place our study on the main pane. If you want it to be a separate pane, create your study with some unique id, as we did with the rsiStudy. Please follow the Pane article for more details.

  1. Also, let's enable a cursor:
chart.isCursorEnabled = true
  1. Enter the license key. Finance SDK is built on top of the SciChart library. In order to see a chart, you must have an active SciChart license. For more details, please, follow the SciChart Android Licensing page. After you obtain your license key, use it in your project, like this:
SciChartSurface.setRuntimeLicenseKey("YOUR_LICENSE_KEY")

Please, follow the Applying for the Runtime License in Your App article for more details.

That's it. You've just created a finance chart app and saved tons of development time.

Finance SDK Demo

Of course, you can change colors, indicator inputs, and everything else. Please read a Study article for more details.