-
Notifications
You must be signed in to change notification settings - Fork 0
Overview
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.
You can create a basic 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 a dataProvider.
val candleDataProvider = DefaultCandleDataProvider()
chart.candleDataProvider = candleDataProvider
// fill the dataProvider with your candlestick 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:
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.
- Also, let's enable a cursor:
chart.isCursorEnabled = true
- 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.
Of course, you can change colors, indicator inputs, and everything else. Please read a Study article for more details.