Giter VIP home page Giter VIP logo

wsb-trendies's People

Contributors

xmcnulty avatar

Watchers

 avatar

wsb-trendies's Issues

Implement Use Case for Market Overview Data

Room repository will act as single source of truth for this data. Implement use cases and repository functions for fetching data from remote API, storing, updating and fetching locally.

Invalid Tickers from Tradestie Api

It appears the tradestie API mistakes some strings in comments for tickers when they are not. Which leads to a NullPointerException being thrown:

"Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter ticker"

This occurs when mapping the DTO to a StockOverview object because there was no data returned ... the stock doesn't actually exist.
Need to figure out a way to handle this.

Fix: Build Warning for Wsb_Comments Room Table

C:\Users\xmcnu\StudioProjects\top-wsb-tickers-android\app\build\tmp\kapt3\stubs\debug\io\xavier\topwsb\domain\model\WsbComment.java:20: warning: ticker_trending_stock column references a foreign key but it is not part of an index. This may trigger full table scans whenever parent table is modified so you are highly advised to create an index that covers this column.

@Entity( tableName = TABLE_NAME_COMMENTS, foreignKeys = [ForeignKey( entity = TrendingStockEntity::class, parentColumns = arrayOf(TICKER_STOCK_COL_NAME), childColumns = arrayOf(TICKER_STOCK_COL_NAME), onDelete = CASCADE )] ) data class WsbComment( @PrimaryKey(autoGenerate = true) @ColumnInfo(name = "comment_id") val id: Int, @ColumnInfo(name = TICKER_STOCK_COL_NAME) val ticker: String, val text: String, val createdUtc: Long, val author: String, val link: String )

Fetch Chart Data

Implement fetching of chart data from remote api. Data will be stored in Room database as single source of truth.

Cache Top Stocks in Room Database

When data is returned from the tradestie api, store it in a room database. When loading from the data first check the room database and update with new data from the api if necessary.

Change chart to intraday

Because this app shows comments for a trending stock in a day- change the price chart to display the intraday data for that day. In the case of a weekend or banking holiday, show the chart for the last trading day.

NullPointerException on some calls to IntradayDataDto.toIntradayData

When running the app and selecting "EV" from the list, the below NullPointerException is thrown. It appears the Dto returned from the repository is null. It is unclear if it is null because the body of the response from the API is empty or if there is an issue with Gson parsing.

java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Set java.util.Map.entrySet()' on a null object reference
at io.xavier.topwsb.domain.mapper.IntradayDataMapperKt.toIntradayData(IntradayDataMapper.kt:55)
at io.xavier.topwsb.data.repository.IntradayDataRepositoryImpl.getIntradayData(IntradayDataRepositoryImpl.kt:19)
at io.xavier.topwsb.data.repository.IntradayDataRepositoryImpl$getIntradayData$1.invokeSuspend(Unknown Source:15)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@7e68393, Dispatchers.Main.immediate]

Separate Get and Refresh List

Separate getTrendingStocks and refreshCache in the repository implementation. This is a better practice. If the cache is empty when calling getTrendingStocks, refreshCache will be called from getTrendingStocks, loading which will populate the cache. getTrendingStocks will always return from the cache. Additionally, a new use case will be needed for refreshing the data that is displayed to the user. Ex.

getTrendingStocks
`
if(stocks.isNotEmpty() {
return stocks
}

refreshCache()

return dao.getTrendingStocks() `

refreshCache

` dao.clearAll()

val stocks = api.getTrendingStocks()

dao.insertAll(stocks) `

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.