Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
com.github.ahmadmo:math-time-series
Advanced tools
The goal of this library is to contain a bunch of common time-series analysis tools and indicators mostly used in technical analysis in finance.
You can use Maven or Gradle to add the library to your project.
<dependency>
<groupId>com.github.ahmadmo</groupId>
<artifactId>math-time-series</artifactId>
<version>0.0.4</version>
</dependency>
dependencies {
compile 'com.github.ahmadmo:math-time-series:0.0.4'
}
import ir.ahmadmo.math.timeseries.trend.*
import org.knowm.xchart.SwingWrapper
import org.knowm.xchart.XYChartBuilder
import org.knowm.xchart.style.Styler
import org.knowm.xchart.style.markers.SeriesMarkers
import kotlin.math.abs
import kotlin.math.min
You need to add the dependency for xchart to run the sample code:
<dependency>
<groupId>org.knowm.xchart</groupId>
<artifactId>xchart</artifactId>
<version>3.6.5</version>
</dependency>
val trend = generateRandomTrend(size = 120)
val smoothingFactors = doubleArrayOf(0.01, 0.02, 0.05, 0.1, 0.15, 0.25)
val (resistance, support, average) = trend.linearTrendLines(smoothingFactors)
val resistanceData = DoubleArray(trend.size, resistance::value)
val supportData = DoubleArray(trend.size, support::value)
val averageData = DoubleArray(trend.size, average::value)
Notice that this is the user's responsibility to choose the rigth values for smoothingFactors
from 0.0
to 1.0
to achieve better results. Choosing higher values results in smoother trends and consequently tighter trend lines. An empty smoothingFactors
disables smoothing.
The function for generating a random trend (time-series):
fun generateRandomTrend(size: Int): Trend {
val trend = Trend(size)
var min = Double.MAX_VALUE
for (x in trend.indices.drop(1)) {
trend[x] = trend[x - 1] + Math.random() - 0.5
min = min(min, trend[x])
}
val shift = abs(min(min, 0.0))
return if (shift == 0.0) trend
else Trend(size) { x -> trend[x] + shift }
}
Finally, to visualize the computed trend lines using xchart: (learn more)
val chart = XYChartBuilder()
.width(1280).height(720)
.theme(Styler.ChartTheme.Matlab)
.title("Trend Lines")
.xAxisTitle("Day").yAxisTitle("Price")
.build()
chart.styler.isPlotGridLinesVisible = false
chart.styler.xAxisTickMarkSpacingHint = 100
val xData = DoubleArray(trend.size, Int::toDouble)
chart.addSeries("Trend", xData, trend)
chart.addSeries("Resistance", xData, resistanceData)
chart.addSeries("Support", xData, supportData)
chart.addSeries("Average", xData, averageData)
chart.seriesMap.values.forEach { it.marker = SeriesMarkers.NONE }
SwingWrapper(chart).displayChart()
Here is the complete sample code demonstrating how to draw linear trend lines for a time-series.
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
FAQs
Mathematics for Time Series
We found that com.github.ahmadmo:math-time-series demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.