The traffic flow prediction is fast becoming a key instrument in the transportation system, which has achieved impressive performance for traffic management. The graph neural network plays a critical role in the development of the traffic network management. However, it is worthwhile mentioning that the complexity of road networks and traffic conditions makes it unable to obtain sufficient spatiotemporal information. In view of capturing precise environment characteristics, the context could have a precise effect on the prediction results while previous methods rarely took this into account. Besides, the nonlinear characteristics of the graph neural network are hard to quantify with fine granularity and to eliminate overfitting. To stack these challenges, in this paper, we present a spatiotemporal graph wavelet neural network to improve the ability of representations. Specifically, we introduce the wavelet transforms into the deep learning model according to the strong nonlinear optimization ability. Furthermore, we dig the location and time patterns to evaluate the temporal dependence and the spatial proximity correlation. In addition, we introduce a historical context attention mechanism giving fine-grained historical context grade evaluation to ease the phenomenon of over-smoothing. The experimental results on real-world datasets show that our work gets considerable results compared with the baseline and start-of-the-art models. Moreover, our work has better learning performance by employing the connection and interaction of graphs.