December 21, 2021
Find missing number in a sequence Minimum complexity | n Log n
December 14, 2021
Squaring and Sorting an input array contains negative and positive number | complexity
December 07, 2021
An application help to know buy or sell stock in stockmaster
November 28, 2021
English to malayalam translation java code
November 14, 2021
Wipro interview question - how to move the said value to one end of an array
September 21, 2021
Firebase | Firestore | Firestore junit test | deep stubbing mockito
September 14, 2021
Google Firebase Firestore Spring boot Integration sample code
September 07, 2021
find word between two strings using regular expression in java
August 28, 2021
Work inside a software firm
August 21, 2021
How to get httprequest inside controller of spring boot
private @Autowired HttpServletRequest request;
HttpServletRequest curRequest =
((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes())
.getRequest();
August 14, 2021
How to get the Path Variables from a URL inside a Spring interceptor
- Assume the URI is http://javabelazy/status/{statusId} and our interceptor is registered for this URI.
- This map would then be a map of a elements,with keys 'statusId '
August 08, 2021
MyG Digital | The best electronic online store | cheating shared in instagram | iphone cheating
August 07, 2021
Tikdata coding test solution
can be ignored.
There are two task you need to perform :
TASK 1 : Convert tickData file in OHLC File :
tick data is the price of the particular stock at any given time. you need to group the data for each stock for each minute and find its Open (first price in that minute) ,
High (highest price in that minute), Low (lowest price in that minute), close(last price of that minute) for that minute. This is called OHLC (open/high/low/close) data.
In a minute we can receive the price of the stocks for upto 100 times.(Not fixed)
e.g.
"STOCK" "LTP" "TIME"
"NQ" 6972.75 08.11.51.319 AM
"NQ" 6974.25 08.12.12.761 AM
"NQ" 6975.25 08.12.42.728 AM
"NQ" 6973.75 08.13.12.700 AM
"NQ" 6974.25 08.13.42.768 AM
For given input above, Output will be
STOCK Open High Low Close TIME
NQ 6972.75 6972.75 6972.75 6972.75 01-NOV-18 08.11.00.00 AM
NQ 6974.25 6975.25 6974.25 6975.25 01-NOV-18 08.12.00.00 AM
NQ 6973.75 6974.25 6973.75 6974.25 01-NOV-18 08.13.00.00 AM
Basically take all prices for the stock in a particular minute, Find its open, high, low, close and print it along with a time and stock name (tab separated).
TASK 2 :
Now since you have OHLC data with you from step 1, you need to calculate the zScore for the stocks. please follow the steps given below to find the zScore of the stocks at a given minute.
1. At any given minute, take the last 20 close prices for that stock. e.g. If we're calculating zScore for 08:20:00 AM , we will take all close prices for the stock from 08:00:00 to 08:19:00.
2. Since we have a list of the last 20 close prices, we will calculate average and standard deviation of the close prices.
3. Now we have average and standard deviation of last 20 prices and current minutes data as well. so zScore = (current_close - average)/standard_deviation;
e.g.
Consider from Task 1 you got the following OHLC data. (This is sample Data only for explanation and not actual data)
Stock open high low close time
NQ 100 100.2 99 100.2 01-NOV-18 09.10.00.00 AM
NQ 100 101.2 99 101.2 01-NOV-18 09.11.00.00 AM
NQ 100 100.2 99 99 01-NOV-18 09.12.00.00 AM
NQ 100 100.2 99 100 01-NOV-18 09.13.00.00 AM
NQ 100 100.2 99 100.2 01-NOV-18 09.14.00.00 AM
NQ 100 100.2 99 100.2 01-NOV-18 09.15.00.00 AM
NQ 100 100.2 99 100 01-NOV-18 09.16.00.00 AM
NQ 100 100.2 99 100.2 01-NOV-18 09.17.00.00 AM
NQ 100 100.2 99 100.2 01-NOV-18 09.18.00.00 AM
NQ 100 103 99 103 01-NOV-18 09.19.00.00 AM
NQ 100 100.2 99 100.2 01-NOV-18 09.20.00.00 AM
NQ 100 100.2 99 100.2 01-NOV-18 09.21.00.00 AM
NQ 100 100.2 99 100.2 01-NOV-18 09.22.00.00 AM
NQ 100 100.2 99 100.2 01-NOV-18 09.23.00.00 AM
NQ 100 100.2 99 100.2 01-NOV-18 09.24.00.00 AM
NQ 100 100.2 99 100.2 01-NOV-18 09.25.00.00 AM
NQ 100 100.2 99 100.2 01-NOV-18 09.26.00.00 AM
NQ 100 100.2 99 100.2 01-NOV-18 09.27.00.00 AM
NQ 100 100.2 99 100.2 01-NOV-18 09.28.00.00 AM
NQ 100 100.2 99 100.2 01-NOV-18 09.29.00.00 AM
NQ 100 100.2 99 100.2 01-NOV-18 09.30.00.00 AM
Now if we wish to calculate zScore at 01-NOV-18 09.30.00.00 AM, We will take previous 20 close prices i.e. From 01-NOV-18 09.10.00.00 AM to 01-NOV-18 09.29.00.00 AM.
Calculate average of the prices and standard_deviation for the same.
average = 100.31
standard_deviation = 0.72974
zScore = (100.2-100.31)/0.72974 = -1.5073
Output should be:
Stock zScore time
NQ -1.5073 01-NOV-18 09.30.00.00 AM
and so on.
July 28, 2021
Parking lot - problem and solution
Problem Statement I own a parking lot that can hold up to 'n' cars at any given point in time. Each slot is given a number starting at 1 increasing with increasing distance from the entry point in steps of one. I want to create an automated ticketing system that allows my customers to use my parking lot without human intervention. When a car enters my parking lot, I want to have a ticket issued to the driver. The ticket issuing process includes us documenting the registration number (number plate) and the colour of the car and allocating an available parking slot to the car before actually handing over a ticket to the driver (we assume that our customers are nice enough to always park in the slots allocated to them). The customer should be allocated a parking slot which is nearest to the entry. At the exit the customer returns the ticket with the time the car was parked in the lot, which then marks the slot they were using as being available. Total parking charge should be calculated as per the parking time. Charge applicable is $10 for first 2 hours and $10 for every additional hour. We interact with the system via a simple set of commands which produce a specific output.
Please take a look at the example below, which includes all the commands you need to support - they're self explanatory
July 21, 2021
What is Apigee
July 14, 2021
io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2Exception: Unexpected HTTP/1.x request: GET Request
July 07, 2021
Spring boot Grpc google remote procedure call full source code
June 07, 2021
IllegalArgumentException no serializer found for class org.mockito and no properties discovered to create beanserializer [Solved]
public void testSomething(){
April 14, 2021
HttpServlet stream closed : inputstream or reader can only be read once [solution]
February 07, 2021
Write a java program to search a value from 2D array
January 28, 2021
Write a java program to rotate 1D array by n steps where n is a positive value
January 21, 2021
An Elephant and the Rope story | Motivational stories
As a man was passing the elephants, he suddenly stopped, confused by the fact that these huge creatures were being held by only a small rope tied to their front leg. No chains, no cages. It was obvious that the elephants could, at anytime, break away from their bonds but for some reason, they did not.
He saw a trainer nearby and asked why these animals just stood there and made no attempt to get away. “Well,” trainer said, “when they are very young and much smaller we use the same size rope to tie them and, at that age, it’s enough to hold them. As they grow up, they are conditioned to believe they cannot break away. They believe the rope can still hold them, so they never try to break free.”
The man was amazed. These animals could at any time break free from their bonds but because they believed they couldn’t, they were stuck right where they were.
Like the elephants, how many of us go through life hanging onto a belief that we cannot do something, simply because we failed at it once before?
Failure is part of learning; we should never give up the struggle in life