-
Notifications
You must be signed in to change notification settings - Fork 2
Quickstart
NOTE: Finance SDK is built on top of the SciChart library. To use it, you must have an active SciChart license. For more details, please, follow the SciChart Android Licensing page.
Finance SDK 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.
Let's see how you can create a chart just in a few steps:
- 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"/>
- Create DataProvider.
val candleDataProvider = DefaultCandleDataProvider()
chart.candleDataProvider = candleDataProvider
// fill the dataProvider with your candlestick data
fillDataProvider(candleDataProvider, StubDataManager.getCandles())
NOTE: Please follow the DataProvider and DataManager section for more details.
- Create Studies. Study is the object that is responsible for charting business logic. Here you decide what your chart should display and how it should be visualized - as a candlestick, line, column, mountain, etc.
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.
NOTE: Of course, you can change colors, indicator inputs, and everything else. Please follow the Modify Study Properties section for more details.
- Also, let's enable a cursor:
chart.isCursorEnabled = true
NOTE: By default, the chart has already a few gesture modifiers, like Zoom, Pan, Y-Axis drag, etc. Please follow the Chart Modifiers section for more details.
- Enter the license key.
NOTE: As mentioned above, Finance SDK is built on top of the SciChart library. 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")
NOTE: Please, follow the Applying the Runtime License in Your App article for more details.
That's it. You've just created a finance chart with candles, indicators, legend, modifiers, resizing, and saved tons of development time.