项目作者: Finnhub-Stock-API

项目描述 :
Finnhub Kotlin API client. Finnhub API provides institutional-grade financial data to investors, fintech startups and investment firms. We support real-time stock price, global fundamentals and alternative data. https://finnhub.io/docs/api
高级语言: Kotlin
项目地址: git://github.com/Finnhub-Stock-API/finnhub-kotlin.git
创建时间: 2020-06-28T21:52:06Z
项目社区:https://github.com/Finnhub-Stock-API/finnhub-kotlin

开源协议:Apache License 2.0

下载


Kotlin client library for Finnhub API

Requires

  • Kotlin 1.3.41
  • Gradle 4.9

Installation

Install package

  1. repositories {
  2. mavenCentral()
  3. }

For Maven

  1. <dependency>
  2. <groupId>io.finnhub</groupId>
  3. <artifactId>kotlin-client</artifactId>
  4. <version>2.0.21</version>
  5. <type>pom</type>
  6. </dependency>

For Gradle

  1. implementation 'io.finnhub:kotlin-client:2.0.21'

Migrate from 1.x.x to 2.x.x

  • Due to recent sunset of Bintray we have migrated the library to Maven
  • For users who have already been using the library from 1.x.x please change package from com.finnhub
    to io.finnhub

Getting Started

  1. import io.finnhub.api.apis.DefaultApi
  2. import io.finnhub.api.infrastructure.ApiClient
  3. ApiClient.apiKey["token"] = "YOUR API KEY"
  4. val apiClient = DefaultApi()
  5. @Test
  6. fun technicalIndicator() {
  7. println(
  8. apiClient.technicalIndicator(
  9. symbol = "AAPL",
  10. resolution = "D",
  11. from = 1583098857L,
  12. to = 1584308457L,
  13. indicator = "sma",
  14. indicatorFields = mapOf<String, Any>("timeperiod" to 3)
  15. )
  16. )
  17. }
  18. @Test
  19. fun stockCandles() {
  20. println(apiClient.stockCandles("AAPL", "D", 1590988249, 1591852249))
  21. }
  22. @Test
  23. fun stockBidask() {
  24. println(apiClient.stockBidask("AAPL"))
  25. }
  26. @Test
  27. fun aggregateIndicator() {
  28. println(apiClient.aggregateIndicator("AAPL", "D"))
  29. }
  30. @Test
  31. fun basicFinancials() {
  32. println(apiClient.companyBasicFinancials("AAPL", "all"))
  33. }
  34. @Test
  35. fun companyEarnings() {
  36. println(apiClient.companyEarnings("TSLA", limit = 5))
  37. }
  38. @Test
  39. fun companyEpsEstimates() {
  40. println(apiClient.companyEpsEstimates("AMZN", freq = "quarterly"))
  41. }
  42. @Test
  43. fun companyExecutive() {
  44. println(apiClient.companyExecutive("AAPL"))
  45. }
  46. @Test
  47. fun companyNews() {
  48. println(apiClient.companyNews("AAPL", from = "2020-06-01", to = "2020-06-10"))
  49. }
  50. @Test
  51. fun newsSentiment() {
  52. println(apiClient.newsSentiment("AAPL"))
  53. }
  54. @Test
  55. fun companyPeers() {
  56. println(apiClient.companyPeers("AAPL"))
  57. }
  58. @Test
  59. fun companyProfile() {
  60. println(apiClient.companyProfile(symbol = "AAPL", isin = null, cusip = null))
  61. println(apiClient.companyProfile(isin = "US0378331005", symbol = null, cusip = null))
  62. println(apiClient.companyProfile(cusip = "037833100", symbol = null, isin = null))
  63. }
  64. @Test
  65. fun companyProfile2() {
  66. println(apiClient.companyProfile2(symbol = "AAPL", isin = null, cusip = null))
  67. }
  68. @Test
  69. fun companyRevenueEstimates() {
  70. println(apiClient.companyRevenueEstimates("TSLA", freq = "quarterly"))
  71. }
  72. @Test
  73. fun country() {
  74. println(apiClient.country())
  75. }
  76. @Test
  77. fun cryptoExchange() {
  78. println(apiClient.cryptoExchanges())
  79. }
  80. @Test
  81. fun cryptoSymbols() {
  82. println(apiClient.cryptoSymbols("BINANCE"))
  83. }
  84. @Test
  85. fun economicData() {
  86. println(apiClient.economicData("MA-USA-656880"))
  87. }
  88. @Test
  89. fun filings() {
  90. println(
  91. apiClient.filings(
  92. symbol = "AAPL",
  93. from = "2020-01-01",
  94. to = "2020-06-11",
  95. accessNumber = null,
  96. cik = null,
  97. form = null
  98. )
  99. )
  100. }
  101. @Test
  102. fun internationalFilings() {
  103. println(apiClient.internationalFilings("AC.TO", ""))
  104. }
  105. @Test
  106. fun filingsSentiment() {
  107. println(apiClient.filingsSentiment("0000320193-20-000052"))
  108. }
  109. @Test
  110. fun similarityIndex() {
  111. println(apiClient.similarityIndex("AAPL", "", "annual"))
  112. }
  113. @Test
  114. fun financials() {
  115. println(apiClient.financials("AAPL", "bs", "annual"))
  116. }
  117. @Test
  118. fun financialsReported() {
  119. println(apiClient.financialsReported(symbol = "AAPL", freq = "annual", accessNumber = null, cik = null))
  120. }
  121. @Test
  122. fun forexExchanges() {
  123. println(apiClient.forexExchanges())
  124. }
  125. @Test
  126. fun forexRates() {
  127. println(apiClient.forexRates(base = "USD", date = ""))
  128. }
  129. @Test
  130. fun forexSymbols() {
  131. println(apiClient.forexSymbols("OANDA"))
  132. }
  133. @Test
  134. fun fundOwnership() {
  135. println(apiClient.fundOwnership("AMZN", limit = 5))
  136. }
  137. @Test
  138. fun generalNews() {
  139. println(apiClient.marketNews("forex", minId = 0))
  140. }
  141. @Test
  142. fun investorsOwnership() {
  143. println(apiClient.ownership("AAPL", limit = 5))
  144. }
  145. @Test
  146. fun ipoCalendar() {
  147. println(apiClient.ipoCalendar(from = "2020-05-01", to = "2020-06-01"))
  148. }
  149. @Test
  150. fun majorDevelopments() {
  151. println(apiClient.pressReleases("AAPL", from = "2020-01-01", to = "2020-12-31"))
  152. }
  153. @Test
  154. fun patternRecognition() {
  155. println(apiClient.patternRecognition("AAPL", "D"))
  156. }
  157. @Test
  158. fun priceTarget() {
  159. println(apiClient.priceTarget("AAPL"))
  160. }
  161. @Test
  162. fun quote() {
  163. println(apiClient.quote("AAPL"))
  164. }
  165. @Test
  166. fun recommendationTrends() {
  167. println(apiClient.recommendationTrends("AAPL"))
  168. }
  169. @Test
  170. fun stockDividends() {
  171. println(apiClient.stockDividends("KO", from = "2019-01-01", to = "2020-01-01"))
  172. }
  173. @Test
  174. fun stockDividends2() {
  175. println(apiClient.stockBasicDividends("KO"))
  176. }
  177. @Test
  178. fun stockSymbols() {
  179. println(apiClient.stockSymbols("US", "", "", ""))
  180. }
  181. @Test
  182. fun transcripts() {
  183. println(apiClient.transcripts("AAPL_162777"))
  184. }
  185. @Test
  186. fun transcriptsList() {
  187. println(apiClient.transcriptsList("AAPL"))
  188. }
  189. @Test
  190. fun earningsCalendar() {
  191. println(apiClient.earningsCalendar(from = "2020-06-10", to = "2020-06-30", symbol = "", international = false))
  192. }
  193. @Test
  194. fun covid19() {
  195. println(apiClient.covid19())
  196. }
  197. @Test
  198. fun fdaCalendar() {
  199. println(apiClient.fdaCommitteeMeetingCalendar())
  200. }
  201. @Test
  202. fun upgradeDowngrade() {
  203. println(apiClient.upgradeDowngrade(symbol = "AAPL", from = "2020-01-01", to = "2020-06-30"))
  204. }
  205. @Test
  206. fun economicCode() {
  207. println(apiClient.economicCode())
  208. }
  209. @Test
  210. fun economicCalendar() {
  211. println(apiClient.economicCalendar())
  212. }
  213. @Test
  214. fun supportResistance() {
  215. println(apiClient.supportResistance("AAPL", "D"))
  216. }
  217. @Test
  218. fun stockSplits() {
  219. println(apiClient.stockSplits(symbol = "AAPL", from = "2000-01-01", to = "2020-01-01"))
  220. }
  221. @Test
  222. fun forexCandles() {
  223. println(apiClient.forexCandles("OANDA:EUR_USD", "D", 1590988249, 1591852249))
  224. }
  225. @Test
  226. fun cryptoCandles() {
  227. println(apiClient.cryptoCandles("BINANCE:BTCUSDT", "D", 1590988249, 1591852249))
  228. }
  229. @Test
  230. fun stockTick() {
  231. println(apiClient.stockTick("AAPL", "2020-03-25", 500, 0))
  232. }
  233. @Test
  234. fun stockBBO() {
  235. println(apiClient.stockNbbo("AAPL", "2020-03-25", 500, 0))
  236. }
  237. @Test
  238. fun indicesConstituents() {
  239. println(apiClient.indicesConstituents("^GSPC"))
  240. }
  241. @Test
  242. fun indicesHistoricalConstituents() {
  243. println(apiClient.indicesHistoricalConstituents("^GSPC"))
  244. }
  245. @Test
  246. fun etfsProfile() {
  247. println(apiClient.etfsProfile("SPY", ""))
  248. }
  249. @Test
  250. fun etfsHoldings() {
  251. println(apiClient.etfsHoldings("SPY", "", 0, ""))
  252. }
  253. @Test
  254. fun etfsSectorExposure() {
  255. println(apiClient.etfsSectorExposure("SPY", ""))
  256. }
  257. @Test
  258. fun etfsCountryExposure() {
  259. println(apiClient.etfsCountryExposure("SPY", ""))
  260. }
  261. @Test
  262. fun mutualFundProfile() {
  263. println(apiClient.mutualFundProfile("VTSAX", ""))
  264. }
  265. @Test
  266. fun mutualFundHoldings() {
  267. println(apiClient.mutualFundHoldings("VTSAX", "", 0))
  268. }
  269. @Test
  270. fun mutualFundSectorExposure() {
  271. println(apiClient.mutualFundSectorExposure("VTSAX", ""))
  272. }
  273. @Test
  274. fun mutualFundCountryExposure() {
  275. println(apiClient.mutualFundCountryExposure("VTSAX", ""))
  276. }
  277. @Test
  278. fun insiderTransactions() {
  279. println(apiClient.insiderTransactions("AAPL", "2021-01-01", "2021-07-07"))
  280. }
  281. @Test
  282. fun revenueBreakdown() {
  283. println(apiClient.revenueBreakdown("AAPL", ""))
  284. }
  285. @Test
  286. fun investmentTheme() {
  287. println(apiClient.investmentThemes("financialExchangesData"))
  288. }
  289. @Test
  290. fun socialSentiment() {
  291. println(apiClient.socialSentiment("GME", "", ""))
  292. }
  293. @Test
  294. fun supplyChain() {
  295. println(apiClient.supplyChainRelationships("AAPL"))
  296. }
  297. @Test
  298. fun symbolSearch() {
  299. println(apiClient.symbolSearch("AAPL"))
  300. }
  301. @Test
  302. fun companyESG() {
  303. println(apiClient.companyEsgScore("AAPL"))
  304. }
  305. @Test
  306. fun cryptoProfile() {
  307. println(apiClient.cryptoProfile("BTC"))
  308. }
  309. @Test
  310. fun companyEbitdaEstimates() {
  311. println(apiClient.companyEbitdaEstimates("AAPL", freq = "quarterly"))
  312. }
  313. @Test
  314. fun companyEbitEstimates() {
  315. println(apiClient.companyEbitEstimates("TSLA", freq = "annual"))
  316. }
  317. @Test
  318. fun stockUsptoPatent() {
  319. println(apiClient.stockUsptoPatent("NVDA", "2021-01-01", "2021-12-31"))
  320. }
  321. @Test
  322. fun stockVisaApplication() {
  323. println(apiClient.stockVisaApplication("AAPL", "2019-01-01", "2021-12-31"))
  324. }
  325. @Test
  326. fun insiderSentiment() {
  327. println(apiClient.insiderSentiment("AAPL", "2019-01-01", "2022-12-31"))
  328. }
  329. @Test
  330. fun marketHoliday() {
  331. println(apiClient.marketHoliday("US"))
  332. }
  333. @Test
  334. fun marketStatus() {
  335. println(apiClient.marketStatus("US"))
  336. }

License

Apache License