-
Notifications
You must be signed in to change notification settings - Fork 2
Overview
andriypohorilko edited this page Apr 4, 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.
So, to create a chart view you will have to do 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 a dataProvider for our chart.
val candleDataProvider = DefaultCandleDataProvider()
chart.candleDataProvider = candleDataProvider
// fill the dataProvider with your data
fillDataProvider(candleDataProvider, DataManager.getCandles())
- Add some studies.
As an example, let's add two studies - PriceSeriesStudy to show candlesticks and RSIStudy to show RSI(Relative Strength Index) indicator:
// Creating our study with a default(PaneId.DEFAULT_PANE) pane id means that we want to place our study on the main pane.
val priceSeriesStudy = PriceSeriesStudy(PaneId.DEFAULT_PANE)
// If you want to place your study on a separate pane, create it with some unique id.
val rsiStudy = RSIStudy(PaneId.uniqueId("RSI"))
chart.studies.add(priceSeriesStudy)
chart.studies.add(rsiStudy)
- Also, let's enable a cursor:
chart.isCursorEnabled = true
That's it. You've just created a finance chart app and saved tons of development time.
Of course, you can change colors, indicator inputs, and everything else. Please read a Study article for more details.